bpmax-cli 0.1.44-beta.8 → 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.
- package/README.md +5 -3
- package/dist/bin.js +466 -4578
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-skills.mjs +0 -98
- package/skills/bpmax-auth/SKILL.md +17 -6
- package/skills/bpmax-cli/SKILL.md +0 -2
- package/skills/bpmax-project/SKILL.md +2 -1
- package/skills/bpmax-shared/SKILL.md +1 -1
- package/skills/bpmax-api-platform-editor/SKILL.md +0 -321
- package/skills/bpmax-api-platform-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-api-platform-editor/references/api-doc-debug-workflow.md +0 -34
- package/skills/bpmax-api-platform-editor/references/api-proxy-shape.md +0 -41
- package/skills/bpmax-api-platform-editor/references/instance-config-shape.md +0 -41
- package/skills/bpmax-api-platform-editor/references/platform-api-map.md +0 -52
- package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +0 -32
- package/skills/bpmax-api-platform-editor/scripts/api_platform_editor_common.py +0 -1276
- package/skills/bpmax-api-platform-editor/scripts/build_submit_payload.py +0 -64
- package/skills/bpmax-api-platform-editor/scripts/capture_write_contract.py +0 -40
- package/skills/bpmax-api-platform-editor/scripts/export_layer_bundle.py +0 -212
- package/skills/bpmax-api-platform-editor/scripts/record_doc_debug_acceptance.py +0 -62
- package/skills/bpmax-api-platform-editor/scripts/submit_and_verify_layer.py +0 -75
- package/skills/bpmax-api-platform-editor/tests/test_api_platform_editor.py +0 -287
- package/skills/bpmax-builder-shared/SKILL.md +0 -44
- package/skills/bpmax-builder-shared/base_url.py +0 -81
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.json +0 -71
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.md +0 -34
- package/skills/bpmax-builder-shared/runtime-script-template-catalog.md +0 -123
- package/skills/bpmax-builder-shared/runtime_script_rules.py +0 -272
- package/skills/bpmax-builder-shared/skill_audit.py +0 -374
- package/skills/bpmax-builder-shared/template_script_hard_rules.py +0 -280
- package/skills/bpmax-builder-shared/tests/test_base_url.py +0 -80
- package/skills/bpmax-builder-shared/tests/test_runtime_script_rules.py +0 -115
- package/skills/bpmax-builder-shared/tests/test_skill_audit.py +0 -231
- package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +0 -281
- package/skills/bpmax-config-latest/SKILL.md +0 -71
- package/skills/bpmax-console-template-editor/SKILL.md +0 -536
- package/skills/bpmax-console-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-console-template-editor/references/filter-integration.md +0 -60
- package/skills/bpmax-console-template-editor/references/lessons-from-resume-dashboard.md +0 -114
- package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +0 -69
- package/skills/bpmax-console-template-editor/references/module-catalog.md +0 -100
- package/skills/bpmax-console-template-editor/references/runtime-page-shape.md +0 -91
- package/skills/bpmax-console-template-editor/references/template-shape.md +0 -149
- package/skills/bpmax-console-template-editor/scripts/build_submit_payload.py +0 -38
- package/skills/bpmax-console-template-editor/scripts/confirm_console_template.py +0 -33
- package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +0 -964
- package/skills/bpmax-console-template-editor/scripts/export_console_template.py +0 -99
- package/skills/bpmax-console-template-editor/scripts/lint_console_template.py +0 -46
- package/skills/bpmax-console-template-editor/scripts/submit_console_template.py +0 -99
- package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +0 -383
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +0 -600
- package/skills/bpmax-dataset-field-template-editor/references/create-request-gotchas.md +0 -25
- package/skills/bpmax-dataset-field-template-editor/references/field-classify-mapping.md +0 -35
- package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +0 -24
- package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +0 -61
- package/skills/bpmax-dataset-field-template-editor/references/virtual-field-patterns.md +0 -27
- package/skills/bpmax-dataset-field-template-editor/references/work-file-to-submit-mapping.md +0 -127
- package/skills/bpmax-dataset-field-template-editor/scripts/build_submit_payload.py +0 -67
- package/skills/bpmax-dataset-field-template-editor/scripts/confirm_dataset_field.py +0 -37
- package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +0 -784
- package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +0 -62
- package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +0 -104
- package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +0 -83
- package/skills/bpmax-dataset-field-template-editor/scripts/lint_dataset_field_semantics.py +0 -35
- package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +0 -95
- package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +0 -709
- package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +0 -59
- package/skills/bpmax-dataset-template-editor/SKILL.md +0 -779
- package/skills/bpmax-dataset-template-editor/references/custom-key-usage-patterns.md +0 -18
- package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +0 -73
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-authoring-guide.md +0 -186
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-example-catalog.md +0 -106
- package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +0 -28
- package/skills/bpmax-dataset-template-editor/references/runtime-verified-dataset-page-shape.md +0 -47
- package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +0 -23
- package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +0 -97
- package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +0 -65
- package/skills/bpmax-dataset-template-editor/scripts/build_submit_payload.py +0 -38
- package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +0 -650
- package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +0 -155
- package/skills/bpmax-dataset-template-editor/scripts/lint_dataset_template.py +0 -42
- package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +0 -43
- package/skills/bpmax-dataset-template-editor/scripts/scan_custom_key_references.py +0 -27
- package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +0 -115
- package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +0 -52
- package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +0 -39
- package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +0 -373
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +0 -177
- package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +0 -4
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +0 -60
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +0 -394
- package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +0 -5
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json +0 -97
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_final_v2.json +0 -105
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_main.json +0 -36
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_region.json +0 -40
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +0 -41
- package/skills/bpmax-e2e-flow-test-operator/references/failure-update-loop.md +0 -17
- package/skills/bpmax-e2e-flow-test-operator/references/filter-field-discovery.md +0 -40
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +0 -24
- package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +0 -75
- package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +0 -107
- package/skills/bpmax-e2e-flow-test-operator/references/skill-experience-coverage-matrix.md +0 -29
- package/skills/bpmax-e2e-flow-test-operator/references/stale-runtime-and-clean-sample-rules.md +0 -54
- package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +0 -83
- package/skills/bpmax-e2e-flow-test-operator/scripts/bpmax_session.py +0 -287
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_plan.json +0 -59
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_runner.py +0 -687
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +0 -121
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +0 -288
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_api_matrix.py +0 -161
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_filter_fields.py +0 -138
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_form_runtime.py +0 -396
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +0 -341
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_test_profile.py +0 -185
- package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +0 -138
- package/skills/bpmax-feishu-chat-flow-plugin-editor/SKILL.md +0 -69
- package/skills/bpmax-feishu-chat-flow-plugin-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-checklist.md +0 -42
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-recipes.md +0 -38
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-shape.md +0 -86
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/gate-lint.md +0 -68
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/hoocoo-patterns.md +0 -39
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/runtime-behavior.md +0 -41
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/script-authoring.md +0 -110
- package/skills/bpmax-feishu-chat-flow-plugin-editor/scripts/lint_feishu_chat_plugin.py +0 -278
- package/skills/bpmax-feishu-chat-flow-plugin-editor/tests/test_lint_feishu_chat_plugin.py +0 -203
- package/skills/bpmax-filter-template-editor/SKILL.md +0 -564
- package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +0 -38
- package/skills/bpmax-filter-template-editor/references/filter-and-flow-binding.md +0 -57
- package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +0 -141
- package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +0 -287
- package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +0 -115
- package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +0 -94
- package/skills/bpmax-filter-template-editor/scripts/build_submit_payload.py +0 -25
- package/skills/bpmax-filter-template-editor/scripts/confirm_filter_template.py +0 -22
- package/skills/bpmax-filter-template-editor/scripts/export_filter_template.py +0 -57
- package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +0 -348
- package/skills/bpmax-filter-template-editor/scripts/init_create_filter_template.py +0 -8
- package/skills/bpmax-filter-template-editor/scripts/lint_filter_template_semantics.py +0 -26
- package/skills/bpmax-filter-template-editor/scripts/submit_filter_template.py +0 -62
- package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +0 -231
- package/skills/bpmax-flow-template-editor/SKILL.md +0 -1058
- package/skills/bpmax-flow-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-flow-template-editor/references/before-next-step-script-runtime-gotchas.md +0 -62
- package/skills/bpmax-flow-template-editor/references/config-surfaces-and-placeholders.md +0 -270
- package/skills/bpmax-flow-template-editor/references/diff-strategy.md +0 -67
- package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +0 -25
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +0 -174
- package/skills/bpmax-flow-template-editor/references/intent-model.md +0 -117
- package/skills/bpmax-flow-template-editor/references/lessons-from-price-plan-flow.md +0 -147
- package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +0 -97
- package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +0 -165
- package/skills/bpmax-flow-template-editor/references/payload-checklist.md +0 -133
- package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +0 -54
- package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +0 -149
- package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +0 -41
- package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +0 -155
- package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +0 -179
- package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +0 -91
- package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +0 -93
- package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +0 -57
- package/skills/bpmax-flow-template-editor/scripts/build_submit_payload.py +0 -69
- package/skills/bpmax-flow-template-editor/scripts/confirm_flow_template.py +0 -52
- package/skills/bpmax-flow-template-editor/scripts/export_flow_template.py +0 -114
- package/skills/bpmax-flow-template-editor/scripts/flow_template_editor_common.py +0 -1084
- package/skills/bpmax-flow-template-editor/scripts/submit_flow_template.py +0 -159
- package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +0 -636
- package/skills/bpmax-form-template-editor/SKILL.md +0 -1099
- package/skills/bpmax-form-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +0 -203
- package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +0 -125
- package/skills/bpmax-form-template-editor/references/payload-checklist.md +0 -77
- package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +0 -49
- package/skills/bpmax-form-template-editor/scripts/build_submit_payload.py +0 -37
- package/skills/bpmax-form-template-editor/scripts/check_form_template_consistency.py +0 -145
- package/skills/bpmax-form-template-editor/scripts/confirm_form_template.py +0 -67
- package/skills/bpmax-form-template-editor/scripts/export_form_template.py +0 -91
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +0 -1762
- package/skills/bpmax-form-template-editor/scripts/lint_form_template_semantics.py +0 -30
- package/skills/bpmax-form-template-editor/scripts/record_runtime_acceptance.py +0 -67
- package/skills/bpmax-form-template-editor/scripts/submit_form_template.py +0 -163
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +0 -1292
- package/skills/bpmax-list-template-editor/SKILL.md +0 -468
- package/skills/bpmax-list-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-list-template-editor/references/browser-page-contract.md +0 -81
- package/skills/bpmax-list-template-editor/references/content-config-shape.md +0 -148
- package/skills/bpmax-list-template-editor/references/dataset-field-mapping.md +0 -60
- package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +0 -103
- package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +0 -102
- package/skills/bpmax-list-template-editor/references/payload-checklist.md +0 -47
- package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +0 -140
- package/skills/bpmax-list-template-editor/references/special-formats.md +0 -394
- package/skills/bpmax-list-template-editor/scripts/build_submit_payload.py +0 -37
- package/skills/bpmax-list-template-editor/scripts/confirm_list_template.py +0 -33
- package/skills/bpmax-list-template-editor/scripts/export_list_template.py +0 -89
- package/skills/bpmax-list-template-editor/scripts/fetch_data_set.py +0 -34
- package/skills/bpmax-list-template-editor/scripts/lint_list_template_semantics.py +0 -54
- package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +0 -955
- package/skills/bpmax-list-template-editor/scripts/record_acceptance.py +0 -55
- package/skills/bpmax-list-template-editor/scripts/submit_list_template.py +0 -117
- package/skills/bpmax-list-template-editor/tests/test_list_template_editor_common.py +0 -441
- package/skills/bpmax-memory-protocol/SKILL.md +0 -72
- package/skills/bpmax-nav-config-editor/SKILL.md +0 -347
- package/skills/bpmax-nav-config-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +0 -68
- package/skills/bpmax-nav-config-editor/references/config-shape.md +0 -78
- package/skills/bpmax-nav-config-editor/references/icon-selection.md +0 -83
- package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +0 -46
- package/skills/bpmax-nav-config-editor/references/payload-checklist.md +0 -41
- package/skills/bpmax-nav-config-editor/references/runtime-probing.md +0 -47
- package/skills/bpmax-nav-config-editor/scripts/build_submit_payload.py +0 -34
- package/skills/bpmax-nav-config-editor/scripts/confirm_nav_config.py +0 -32
- package/skills/bpmax-nav-config-editor/scripts/export_nav_config.py +0 -56
- package/skills/bpmax-nav-config-editor/scripts/lint_nav_config_semantics.py +0 -33
- package/skills/bpmax-nav-config-editor/scripts/nav_config_editor_common.py +0 -812
- package/skills/bpmax-nav-config-editor/scripts/submit_nav_config.py +0 -44
- package/skills/bpmax-nav-config-editor/scripts/verify_nav_config.py +0 -33
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor.py +0 -358
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor_common.py +0 -138
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_lint.py +0 -58
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_submit_verify.py +0 -51
- package/skills/bpmax-project-detail-template-editor/SKILL.md +0 -329
- package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-project-detail-template-editor/references/local-temp-workflow.md +0 -59
- package/skills/bpmax-project-detail-template-editor/references/module-catalog-and-config-notes.md +0 -47
- package/skills/bpmax-project-detail-template-editor/references/payload-checklist.md +0 -33
- package/skills/bpmax-project-detail-template-editor/references/project-detail-template-api-workflow.md +0 -44
- package/skills/bpmax-project-detail-template-editor/scripts/build_submit_payload.py +0 -30
- package/skills/bpmax-project-detail-template-editor/scripts/confirm_project_detail_template.py +0 -33
- package/skills/bpmax-project-detail-template-editor/scripts/export_project_detail_template.py +0 -87
- package/skills/bpmax-project-detail-template-editor/scripts/lint_project_detail_template_semantics.py +0 -37
- package/skills/bpmax-project-detail-template-editor/scripts/project_detail_template_editor_common.py +0 -507
- package/skills/bpmax-project-detail-template-editor/scripts/submit_project_detail_template.py +0 -120
- package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py +0 -369
- package/skills/bpmax-role-editor/SKILL.md +0 -251
- package/skills/bpmax-role-editor/references/api-workflow.md +0 -30
- package/skills/bpmax-role-editor/references/runtime-page-shape.md +0 -18
- package/skills/bpmax-role-editor/references/work-file-mapping.md +0 -32
- package/skills/bpmax-role-editor/scripts/build_submit_payload.py +0 -38
- package/skills/bpmax-role-editor/scripts/confirm_role.py +0 -33
- package/skills/bpmax-role-editor/scripts/export_role.py +0 -163
- package/skills/bpmax-role-editor/scripts/lint_role_semantics.py +0 -38
- package/skills/bpmax-role-editor/scripts/role_editor_common.py +0 -1231
- package/skills/bpmax-role-editor/scripts/submit_role.py +0 -144
- package/skills/bpmax-role-editor/tests/test_role_editor.py +0 -343
- package/skills/bpmax-user-mock-operator/SKILL.md +0 -106
- package/skills/bpmax-user-mock-operator/agents/openai.yaml +0 -4
- package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +0 -37
- package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +0 -136
- package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +0 -138
- package/skills/form-control-library/SKILL.md +0 -82
- package/skills/form-control-library/agents/openai.yaml +0 -4
- package/skills/form-control-library/references/form-controls.md +0 -199
- package/skills/form-control-library/references/form-template-submit-schema.md +0 -180
- package/skills/form-control-library/references/group-select-runtime.md +0 -191
- package/skills/form-control-library/scripts/rebuild_form_control_library.py +0 -55
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import argparse
|
|
5
|
-
|
|
6
|
-
from filter_template_editor_common import build_client, build_create_skeleton, detail_to_work_payload, dump_json, paths_for, write_diff
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def main() -> int:
|
|
10
|
-
p = argparse.ArgumentParser(description="Export an online BPMAX filter-template into local temp files.")
|
|
11
|
-
p.add_argument("--template-id", type=int)
|
|
12
|
-
p.add_argument("--create-skeleton", action="store_true")
|
|
13
|
-
p.add_argument("--flow-type")
|
|
14
|
-
p.add_argument("--flow-key", default="")
|
|
15
|
-
p.add_argument("--name", default="")
|
|
16
|
-
p.add_argument("--desc", default="")
|
|
17
|
-
p.add_argument("--workspace")
|
|
18
|
-
p.add_argument("--base-url")
|
|
19
|
-
p.add_argument("--language", default="zhCN")
|
|
20
|
-
p.add_argument("--cookie-header")
|
|
21
|
-
p.add_argument("--timeout", type=float, default=30)
|
|
22
|
-
p.add_argument("--insecure", action="store_true")
|
|
23
|
-
args = p.parse_args()
|
|
24
|
-
if args.create_skeleton:
|
|
25
|
-
if not args.flow_type:
|
|
26
|
-
raise SystemExit("--flow-type is required for --create-skeleton")
|
|
27
|
-
stem = f"create-{args.flow_type}-{args.flow_key or 'default'}"
|
|
28
|
-
raw = {
|
|
29
|
-
"name": args.name,
|
|
30
|
-
"desc": args.desc,
|
|
31
|
-
"flow_type": args.flow_type,
|
|
32
|
-
"flow_key": args.flow_key,
|
|
33
|
-
"type": 3,
|
|
34
|
-
"status": 1,
|
|
35
|
-
"content": "{\"config\":[]}",
|
|
36
|
-
}
|
|
37
|
-
work = build_create_skeleton(flow_type=args.flow_type, flow_key=args.flow_key, name=args.name, desc=args.desc)
|
|
38
|
-
else:
|
|
39
|
-
if not args.template_id:
|
|
40
|
-
raise SystemExit("--template-id is required for edit export")
|
|
41
|
-
client = build_client(args)
|
|
42
|
-
raw = client.get_template(args.template_id).get("data") or {}
|
|
43
|
-
stem = str(args.template_id)
|
|
44
|
-
work = detail_to_work_payload(raw, mode="edit")
|
|
45
|
-
paths = paths_for(stem)
|
|
46
|
-
dump_json(paths["raw"], raw)
|
|
47
|
-
dump_json(paths["work"], work)
|
|
48
|
-
dump_json(paths["meta"], {"stem": stem, "mode": work.get("mode"), "workspace": getattr(args, "workspace", None), "status": "exported"})
|
|
49
|
-
write_diff(paths["work_diff"], raw, work, "raw", "work")
|
|
50
|
-
print(paths["raw"])
|
|
51
|
-
print(paths["work"])
|
|
52
|
-
print(paths["meta"])
|
|
53
|
-
return 0
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if __name__ == "__main__":
|
|
57
|
-
raise SystemExit(main())
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import copy
|
|
5
|
-
import hashlib
|
|
6
|
-
import json
|
|
7
|
-
import ssl
|
|
8
|
-
import sys
|
|
9
|
-
import urllib.error
|
|
10
|
-
import urllib.parse
|
|
11
|
-
import urllib.request
|
|
12
|
-
from dataclasses import dataclass
|
|
13
|
-
from datetime import datetime, timezone
|
|
14
|
-
from difflib import unified_diff
|
|
15
|
-
from pathlib import Path
|
|
16
|
-
from typing import Any, Dict, Optional
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
DEFAULT_LANGUAGE = "zhCN"
|
|
20
|
-
REPO_ROOT = Path(__file__).resolve().parents[4]
|
|
21
|
-
SHARED_SKILL_ROOT = Path(__file__).resolve().parents[2] / "bpmax-builder-shared"
|
|
22
|
-
if str(SHARED_SKILL_ROOT) not in sys.path:
|
|
23
|
-
sys.path.insert(0, str(SHARED_SKILL_ROOT))
|
|
24
|
-
from base_url import resolve_base_url
|
|
25
|
-
TMP_ROOT = REPO_ROOT / ".codex" / "tmp" / "filter-template-editor"
|
|
26
|
-
TMP_SUBDIRS = ("raw", "work", "meta", "submit", "diffs", "result")
|
|
27
|
-
|
|
28
|
-
from template_script_hard_rules import scan_named_script_surfaces
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def utc_now_iso() -> str:
|
|
32
|
-
return datetime.now(timezone.utc).isoformat()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def ensure_tmp_dirs() -> None:
|
|
36
|
-
for part in TMP_SUBDIRS:
|
|
37
|
-
(TMP_ROOT / part).mkdir(parents=True, exist_ok=True)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def paths_for(stem: str) -> Dict[str, Path]:
|
|
41
|
-
ensure_tmp_dirs()
|
|
42
|
-
return {
|
|
43
|
-
"raw": TMP_ROOT / "raw" / f"{stem}.json",
|
|
44
|
-
"work": TMP_ROOT / "work" / f"{stem}.json",
|
|
45
|
-
"meta": TMP_ROOT / "meta" / f"{stem}.json",
|
|
46
|
-
"submit": TMP_ROOT / "submit" / f"{stem}.json",
|
|
47
|
-
"work_diff": TMP_ROOT / "diffs" / f"{stem}.work.diff.txt",
|
|
48
|
-
"submit_diff": TMP_ROOT / "diffs" / f"{stem}.submit.diff.txt",
|
|
49
|
-
"response": TMP_ROOT / "result" / f"{stem}.response.json",
|
|
50
|
-
"readback": TMP_ROOT / "result" / f"{stem}.readback.json",
|
|
51
|
-
"verify": TMP_ROOT / "result" / f"{stem}.verify.json",
|
|
52
|
-
"lint": TMP_ROOT / "result" / f"{stem}.lint.json",
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def dump_json(path: Path, payload: Any) -> None:
|
|
57
|
-
path.parent.mkdir(parents=True, exist_ok=True)
|
|
58
|
-
path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def load_json(path: Path) -> Any:
|
|
62
|
-
return json.loads(path.read_text(encoding="utf-8"))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def file_sha256(path: Path) -> str:
|
|
66
|
-
return hashlib.sha256(path.read_bytes()).hexdigest()
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def stable_json_lines(payload: Any) -> list[str]:
|
|
70
|
-
return (json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True) + "\n").splitlines(keepends=True)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def write_diff(path: Path, before: Any, after: Any, before_label: str, after_label: str) -> None:
|
|
74
|
-
diff = unified_diff(stable_json_lines(before), stable_json_lines(after), fromfile=before_label, tofile=after_label)
|
|
75
|
-
path.parent.mkdir(parents=True, exist_ok=True)
|
|
76
|
-
path.write_text("".join(diff) or "# no diff\n", encoding="utf-8")
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def parse_content(value: Any) -> Dict[str, Any]:
|
|
80
|
-
if isinstance(value, dict):
|
|
81
|
-
return copy.deepcopy(value)
|
|
82
|
-
if isinstance(value, str):
|
|
83
|
-
text = value.strip()
|
|
84
|
-
if not text:
|
|
85
|
-
return {"config": []}
|
|
86
|
-
payload = json.loads(text)
|
|
87
|
-
if not isinstance(payload, dict):
|
|
88
|
-
raise SystemExit("filter content must be an object")
|
|
89
|
-
return payload
|
|
90
|
-
raise SystemExit("filter content must be a JSON string or object")
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def detail_to_work_payload(detail: Dict[str, Any], *, mode: str = "edit") -> Dict[str, Any]:
|
|
94
|
-
return {
|
|
95
|
-
"id": detail.get("id") if mode == "edit" else None,
|
|
96
|
-
"mode": mode,
|
|
97
|
-
"basic": {
|
|
98
|
-
"name": detail.get("name", ""),
|
|
99
|
-
"desc": detail.get("desc", ""),
|
|
100
|
-
"flow_type": detail.get("flow_type", ""),
|
|
101
|
-
"flow_key": detail.get("flow_key", ""),
|
|
102
|
-
"type": 3,
|
|
103
|
-
"status": detail.get("status", 1),
|
|
104
|
-
},
|
|
105
|
-
"content": parse_content(detail.get("content")),
|
|
106
|
-
"detailOnly": {"searchTemp": copy.deepcopy(detail.get("searchTemp"))},
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def build_create_skeleton(*, flow_type: str, flow_key: str = "", name: str = "", desc: str = "") -> Dict[str, Any]:
|
|
111
|
-
return {
|
|
112
|
-
"id": None,
|
|
113
|
-
"mode": "create",
|
|
114
|
-
"basic": {
|
|
115
|
-
"name": name,
|
|
116
|
-
"desc": desc,
|
|
117
|
-
"flow_type": flow_type,
|
|
118
|
-
"flow_key": flow_key,
|
|
119
|
-
"type": 3,
|
|
120
|
-
"status": 1,
|
|
121
|
-
},
|
|
122
|
-
"content": {"config": []},
|
|
123
|
-
"detailOnly": {"searchTemp": None},
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
def build_submit_payload(work: Dict[str, Any]) -> Dict[str, Any]:
|
|
128
|
-
basic = copy.deepcopy(work.get("basic") or {})
|
|
129
|
-
content = copy.deepcopy(work.get("content") or {})
|
|
130
|
-
if not isinstance(content.get("config", []), list):
|
|
131
|
-
raise SystemExit("content.config must be an array")
|
|
132
|
-
submit = {
|
|
133
|
-
"name": basic.get("name", ""),
|
|
134
|
-
"desc": basic.get("desc", ""),
|
|
135
|
-
"flow_type": basic.get("flow_type", ""),
|
|
136
|
-
"flow_key": basic.get("flow_key", ""),
|
|
137
|
-
"type": 3,
|
|
138
|
-
"content": json.dumps(content, ensure_ascii=False),
|
|
139
|
-
}
|
|
140
|
-
if work.get("mode") == "create":
|
|
141
|
-
submit["status"] = basic.get("status", 1)
|
|
142
|
-
return submit
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
def lint_filter_template_semantics(work_payload: Dict[str, Any], *, submit_payload: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
|
146
|
-
payload = submit_payload or build_submit_payload(work_payload)
|
|
147
|
-
report: Dict[str, Any] = {"ok": True, "errors": [], "warnings": [], "checks": {}}
|
|
148
|
-
content = parse_content(payload.get("content"))
|
|
149
|
-
config = content.get("config") or []
|
|
150
|
-
if not isinstance(config, list):
|
|
151
|
-
report["errors"].append("content.config must be an array")
|
|
152
|
-
if payload.get("type") != 3:
|
|
153
|
-
report["errors"].append("submit.type must be 3")
|
|
154
|
-
hard_rule_report = scan_named_script_surfaces(
|
|
155
|
-
[
|
|
156
|
-
{"path": "content.config", "value": config},
|
|
157
|
-
{"path": "content.customQuery", "value": content.get("customQuery")},
|
|
158
|
-
{"path": "content.beforeSearch", "value": content.get("beforeSearch")},
|
|
159
|
-
{"path": "content.tabFilters", "value": content.get("tabFilters")},
|
|
160
|
-
]
|
|
161
|
-
)
|
|
162
|
-
report["checks"]["scriptHardRules"] = hard_rule_report["findings"]
|
|
163
|
-
report["errors"].extend(hard_rule_report["errors"])
|
|
164
|
-
report["checks"]["configCount"] = len(config) if isinstance(config, list) else None
|
|
165
|
-
report["ok"] = not report["errors"]
|
|
166
|
-
return report
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def summarize_verification(submit_payload: Dict[str, Any], readback_detail: Dict[str, Any]) -> Dict[str, Any]:
|
|
170
|
-
checks: Dict[str, Dict[str, Any]] = {}
|
|
171
|
-
ok = True
|
|
172
|
-
for key in ("name", "desc", "flow_type", "flow_key", "type"):
|
|
173
|
-
expected = submit_payload.get(key)
|
|
174
|
-
actual = readback_detail.get(key)
|
|
175
|
-
match = expected == actual
|
|
176
|
-
checks[key] = {"match": match, "expected": expected, "actual": actual}
|
|
177
|
-
ok = ok and match
|
|
178
|
-
|
|
179
|
-
expected_content = parse_content(submit_payload.get("content"))
|
|
180
|
-
actual_content = parse_content(readback_detail.get("content"))
|
|
181
|
-
content_match = expected_content == actual_content
|
|
182
|
-
checks["content"] = {
|
|
183
|
-
"match": content_match,
|
|
184
|
-
"expectedSummary": {
|
|
185
|
-
"configCount": len(expected_content.get("config") or []),
|
|
186
|
-
"hasCustomQuery": "customQuery" in expected_content,
|
|
187
|
-
"hasBeforeSearch": "beforeSearch" in expected_content,
|
|
188
|
-
"hasTabFilters": "tabFilters" in expected_content,
|
|
189
|
-
},
|
|
190
|
-
"actualSummary": {
|
|
191
|
-
"configCount": len(actual_content.get("config") or []),
|
|
192
|
-
"hasCustomQuery": "customQuery" in actual_content,
|
|
193
|
-
"hasBeforeSearch": "beforeSearch" in actual_content,
|
|
194
|
-
"hasTabFilters": "tabFilters" in actual_content,
|
|
195
|
-
},
|
|
196
|
-
}
|
|
197
|
-
ok = ok and content_match
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
"ok": ok,
|
|
201
|
-
"checks": checks,
|
|
202
|
-
"submittedContent": expected_content,
|
|
203
|
-
"readbackContent": actual_content,
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
def extract_template_id(response_payload: Dict[str, Any]) -> int | None:
|
|
208
|
-
data = response_payload.get("data")
|
|
209
|
-
if isinstance(data, dict) and isinstance(data.get("id"), int):
|
|
210
|
-
return data["id"]
|
|
211
|
-
if isinstance(response_payload.get("id"), int):
|
|
212
|
-
return response_payload["id"]
|
|
213
|
-
return None
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
def ensure_meta_shape(meta: Dict[str, Any], stem: str) -> Dict[str, Any]:
|
|
217
|
-
payload = dict(meta)
|
|
218
|
-
payload.setdefault("stem", stem)
|
|
219
|
-
payload.setdefault("status", "exported")
|
|
220
|
-
payload.setdefault("mode", None)
|
|
221
|
-
payload.setdefault("workspace", None)
|
|
222
|
-
payload.setdefault("workSha256", None)
|
|
223
|
-
payload.setdefault("submitSha256", None)
|
|
224
|
-
payload.setdefault("workConfirmedAt", None)
|
|
225
|
-
payload.setdefault("submitConfirmedAt", None)
|
|
226
|
-
payload.setdefault("submitBuiltAt", None)
|
|
227
|
-
payload.setdefault("lintPassed", False)
|
|
228
|
-
payload.setdefault("lintSha256", None)
|
|
229
|
-
payload.setdefault("lintedAt", None)
|
|
230
|
-
return payload
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
def update_confirmation_state(meta_path: Path, *, stem: str, actor: str, stage: str, work_path: Path, submit_path: Optional[Path] = None) -> Dict[str, Any]:
|
|
234
|
-
payload = ensure_meta_shape(load_json(meta_path) if meta_path.exists() else {}, stem)
|
|
235
|
-
payload["workSha256"] = file_sha256(work_path)
|
|
236
|
-
now = utc_now_iso()
|
|
237
|
-
if stage == "work":
|
|
238
|
-
payload["workConfirmedAt"] = now
|
|
239
|
-
payload["submitConfirmedAt"] = None
|
|
240
|
-
payload["status"] = "work_confirmed"
|
|
241
|
-
elif stage == "submit":
|
|
242
|
-
if submit_path is None or not submit_path.exists():
|
|
243
|
-
raise SystemExit("submit confirmation requires existing submit file")
|
|
244
|
-
if payload.get("status") not in ("submit_built", "lint_passed"):
|
|
245
|
-
raise SystemExit("submit confirmation requires submit_built or lint_passed status")
|
|
246
|
-
payload["submitSha256"] = file_sha256(submit_path)
|
|
247
|
-
payload["submitConfirmedAt"] = now
|
|
248
|
-
payload["status"] = "submit_confirmed"
|
|
249
|
-
else:
|
|
250
|
-
raise SystemExit(f"unsupported confirmation stage: {stage}")
|
|
251
|
-
dump_json(meta_path, payload)
|
|
252
|
-
return payload
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
def update_build_meta(meta_path: Path, *, stem: str, work_path: Path, submit_path: Path) -> Dict[str, Any]:
|
|
256
|
-
payload = ensure_meta_shape(load_json(meta_path) if meta_path.exists() else {}, stem)
|
|
257
|
-
payload["workSha256"] = file_sha256(work_path)
|
|
258
|
-
payload["submitSha256"] = file_sha256(submit_path)
|
|
259
|
-
payload["submitBuiltAt"] = utc_now_iso()
|
|
260
|
-
payload["lintPassed"] = False
|
|
261
|
-
payload["lintSha256"] = None
|
|
262
|
-
payload["lintedAt"] = None
|
|
263
|
-
payload["status"] = "submit_built"
|
|
264
|
-
dump_json(meta_path, payload)
|
|
265
|
-
return payload
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
def update_lint_meta(meta_path: Path, *, stem: str, submit_path: Path, lint_path: Path, report: Dict[str, Any]) -> Dict[str, Any]:
|
|
269
|
-
payload = ensure_meta_shape(load_json(meta_path) if meta_path.exists() else {}, stem)
|
|
270
|
-
payload["submitSha256"] = file_sha256(submit_path)
|
|
271
|
-
payload["lintPassed"] = bool(report.get("ok"))
|
|
272
|
-
payload["lintSha256"] = file_sha256(lint_path)
|
|
273
|
-
payload["lintedAt"] = utc_now_iso()
|
|
274
|
-
payload["status"] = "lint_passed" if report.get("ok") else "lint_failed"
|
|
275
|
-
dump_json(meta_path, payload)
|
|
276
|
-
return payload
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
def ensure_submission_allowed(meta_path: Path, work_path: Path, submit_path: Path) -> Dict[str, Any]:
|
|
280
|
-
if not meta_path.exists():
|
|
281
|
-
raise SystemExit("missing meta confirmation file")
|
|
282
|
-
meta_raw = load_json(meta_path)
|
|
283
|
-
meta = ensure_meta_shape(meta_raw, meta_raw.get("stem", "unknown"))
|
|
284
|
-
if meta.get("status") != "submit_confirmed":
|
|
285
|
-
raise SystemExit("submission blocked: current status is not submit_confirmed")
|
|
286
|
-
if meta.get("lintPassed") is not True:
|
|
287
|
-
raise SystemExit("submission blocked: lint has not passed")
|
|
288
|
-
if meta.get("workSha256") != file_sha256(work_path):
|
|
289
|
-
raise SystemExit("submission blocked: work file changed after confirmation")
|
|
290
|
-
if meta.get("submitSha256") != file_sha256(submit_path):
|
|
291
|
-
raise SystemExit("submission blocked: submit file changed after confirmation")
|
|
292
|
-
lint_report = lint_filter_template_semantics(load_json(work_path), submit_payload=load_json(submit_path))
|
|
293
|
-
if lint_report["errors"]:
|
|
294
|
-
raise SystemExit("submission blocked by lint: " + "; ".join(lint_report["errors"]))
|
|
295
|
-
return meta
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
@dataclass
|
|
299
|
-
class ApiClient:
|
|
300
|
-
base_url: str
|
|
301
|
-
workspace: str
|
|
302
|
-
language: str
|
|
303
|
-
cookie_header: str
|
|
304
|
-
timeout: float
|
|
305
|
-
insecure: bool = False
|
|
306
|
-
|
|
307
|
-
def _build_url(self, path: str) -> str:
|
|
308
|
-
suffix = f"$workspace={urllib.parse.quote(self.workspace)}&$language={urllib.parse.quote(self.language)}"
|
|
309
|
-
joiner = "&" if "?" in path else "?"
|
|
310
|
-
return self.base_url.rstrip("/") + path + joiner + suffix
|
|
311
|
-
|
|
312
|
-
def request(self, method: str, path: str, body: Optional[dict] = None) -> dict:
|
|
313
|
-
headers = {"content-type": "application/json", "cookie": self.cookie_header, "accept": "application/json, text/plain, */*"}
|
|
314
|
-
data = None if body is None else json.dumps(body, ensure_ascii=False).encode("utf-8")
|
|
315
|
-
req = urllib.request.Request(self._build_url(path), data=data, headers=headers, method=method)
|
|
316
|
-
context = ssl._create_unverified_context() if self.insecure else None
|
|
317
|
-
with urllib.request.urlopen(req, timeout=self.timeout, context=context) as resp:
|
|
318
|
-
raw = resp.read().decode("utf-8", "replace")
|
|
319
|
-
payload = json.loads(raw)
|
|
320
|
-
if payload.get("code") != 0:
|
|
321
|
-
raise SystemExit(f"API error {path}: {raw}")
|
|
322
|
-
return payload
|
|
323
|
-
|
|
324
|
-
def get_template(self, template_id: int) -> dict:
|
|
325
|
-
return self.request("GET", f"/api/flow_page_template/{template_id}?skip_i18n=true")
|
|
326
|
-
|
|
327
|
-
def create_template(self, payload: dict) -> dict:
|
|
328
|
-
return self.request("POST", "/api/flow_page_template", payload)
|
|
329
|
-
|
|
330
|
-
def update_template(self, template_id: int, payload: dict) -> dict:
|
|
331
|
-
return self.request("PUT", f"/api/flow_page_template/{template_id}", payload)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
def build_client(args: Any) -> ApiClient:
|
|
335
|
-
workspace = getattr(args, "workspace", None)
|
|
336
|
-
cookie_header = getattr(args, "cookie_header", None)
|
|
337
|
-
if not workspace:
|
|
338
|
-
raise SystemExit("--workspace is required")
|
|
339
|
-
if not cookie_header:
|
|
340
|
-
raise SystemExit("--cookie-header is required")
|
|
341
|
-
return ApiClient(
|
|
342
|
-
base_url=resolve_base_url(getattr(args, "base_url", None)),
|
|
343
|
-
workspace=workspace,
|
|
344
|
-
language=getattr(args, "language", None) or DEFAULT_LANGUAGE,
|
|
345
|
-
cookie_header=cookie_header,
|
|
346
|
-
timeout=float(getattr(args, "timeout", 30)),
|
|
347
|
-
insecure=bool(getattr(args, "insecure", False)),
|
|
348
|
-
)
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import argparse
|
|
5
|
-
|
|
6
|
-
from filter_template_editor_common import dump_json, lint_filter_template_semantics, load_json, paths_for, update_lint_meta
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def main() -> int:
|
|
10
|
-
p = argparse.ArgumentParser(description="Run semantic lint checks for a local BPMAX filter-template work/submit pair.")
|
|
11
|
-
p.add_argument("--stem", required=True)
|
|
12
|
-
args = p.parse_args()
|
|
13
|
-
paths = paths_for(args.stem)
|
|
14
|
-
work = load_json(paths["work"])
|
|
15
|
-
submit = load_json(paths["submit"])
|
|
16
|
-
report = lint_filter_template_semantics(work, submit_payload=submit)
|
|
17
|
-
dump_json(paths["lint"], report)
|
|
18
|
-
update_lint_meta(paths["meta"], stem=args.stem, submit_path=paths["submit"], lint_path=paths["lint"], report=report)
|
|
19
|
-
print(paths["lint"])
|
|
20
|
-
if not report["ok"]:
|
|
21
|
-
raise SystemExit("filter-template lint failed; inspect lint.json for details")
|
|
22
|
-
return 0
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if __name__ == "__main__":
|
|
26
|
-
raise SystemExit(main())
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import sys
|
|
5
|
-
|
|
6
|
-
print(
|
|
7
|
-
"Legacy config submit scripts are disabled in bpmax-cli. Use `bpmax-cli config filter-template submit` so capability, dry-run, confirmation, audit, and baseline checks are enforced.",
|
|
8
|
-
file=sys.stderr,
|
|
9
|
-
)
|
|
10
|
-
sys.exit(2)
|
|
11
|
-
|
|
12
|
-
import argparse
|
|
13
|
-
|
|
14
|
-
from filter_template_editor_common import (
|
|
15
|
-
build_client,
|
|
16
|
-
dump_json,
|
|
17
|
-
ensure_submission_allowed,
|
|
18
|
-
extract_template_id,
|
|
19
|
-
load_json,
|
|
20
|
-
paths_for,
|
|
21
|
-
summarize_verification,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def main() -> int:
|
|
26
|
-
p = argparse.ArgumentParser(description="Submit a local BPMAX filter-template payload and verify readback.")
|
|
27
|
-
p.add_argument("--stem", required=True)
|
|
28
|
-
p.add_argument("--workspace")
|
|
29
|
-
p.add_argument("--base-url")
|
|
30
|
-
p.add_argument("--language", default="zhCN")
|
|
31
|
-
p.add_argument("--cookie-header")
|
|
32
|
-
p.add_argument("--timeout", type=float, default=30)
|
|
33
|
-
p.add_argument("--insecure", action="store_true")
|
|
34
|
-
args = p.parse_args()
|
|
35
|
-
paths = paths_for(args.stem)
|
|
36
|
-
meta = ensure_submission_allowed(paths["meta"], paths["work"], paths["submit"])
|
|
37
|
-
client = build_client(args)
|
|
38
|
-
submit_payload = load_json(paths["submit"])
|
|
39
|
-
if meta.get("mode") == "create":
|
|
40
|
-
response = client.create_template(submit_payload)
|
|
41
|
-
template_id = extract_template_id(response)
|
|
42
|
-
if not template_id:
|
|
43
|
-
raise SystemExit("create response did not include a template id")
|
|
44
|
-
else:
|
|
45
|
-
template_id = int(args.stem)
|
|
46
|
-
response = client.update_template(template_id, submit_payload)
|
|
47
|
-
readback = (client.get_template(template_id).get("data") or {})
|
|
48
|
-
verification = summarize_verification(submit_payload, readback)
|
|
49
|
-
verify = {"ok": verification["ok"], "templateId": template_id, "verification": verification}
|
|
50
|
-
dump_json(paths["response"], response)
|
|
51
|
-
dump_json(paths["readback"], readback)
|
|
52
|
-
dump_json(paths["verify"], verify)
|
|
53
|
-
print(paths["response"])
|
|
54
|
-
print(paths["readback"])
|
|
55
|
-
print(paths["verify"])
|
|
56
|
-
if not verify["ok"]:
|
|
57
|
-
raise SystemExit("filter-template verify failed; inspect verify.json for details")
|
|
58
|
-
return 0
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if __name__ == "__main__":
|
|
62
|
-
raise SystemExit(main())
|