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.
- package/README.md +5 -3
- package/dist/bin.js +461 -4663
- 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,99 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import argparse
|
|
5
|
-
|
|
6
|
-
from console_template_editor_common import (
|
|
7
|
-
build_client,
|
|
8
|
-
build_create_work_payload,
|
|
9
|
-
detail_to_work_payload,
|
|
10
|
-
dump_json,
|
|
11
|
-
extract_api_data,
|
|
12
|
-
paths_for,
|
|
13
|
-
sanitize_create_detail,
|
|
14
|
-
write_diff,
|
|
15
|
-
write_export_meta,
|
|
16
|
-
create_stem,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def build_parser() -> argparse.ArgumentParser:
|
|
21
|
-
p = argparse.ArgumentParser(description="Export an online BPMAX console template into local temp files.")
|
|
22
|
-
p.add_argument("--template-id", type=int)
|
|
23
|
-
p.add_argument("--create-skeleton", action="store_true")
|
|
24
|
-
p.add_argument("--sample-template-id", type=int)
|
|
25
|
-
p.add_argument("--workspace")
|
|
26
|
-
p.add_argument("--base-url")
|
|
27
|
-
p.add_argument("--language", default="zhCN")
|
|
28
|
-
p.add_argument("--cookie-header")
|
|
29
|
-
p.add_argument("--timeout", type=float, default=30)
|
|
30
|
-
p.add_argument("--insecure", action="store_true")
|
|
31
|
-
return p
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def main() -> int:
|
|
35
|
-
args = build_parser().parse_args()
|
|
36
|
-
if args.create_skeleton:
|
|
37
|
-
if not args.sample_template_id:
|
|
38
|
-
raise SystemExit("--create-skeleton requires --sample-template-id")
|
|
39
|
-
elif not args.template_id:
|
|
40
|
-
raise SystemExit("editing export requires --template-id")
|
|
41
|
-
|
|
42
|
-
client = build_client(args)
|
|
43
|
-
if args.create_skeleton:
|
|
44
|
-
sample_response = client.get_template(args.sample_template_id)
|
|
45
|
-
sample_detail = extract_api_data(sample_response)
|
|
46
|
-
if not isinstance(sample_detail, dict):
|
|
47
|
-
raise SystemExit("sample template detail must be a JSON object")
|
|
48
|
-
raw_detail = sanitize_create_detail(sample_detail)
|
|
49
|
-
stem = create_stem(client.workspace, args.sample_template_id)
|
|
50
|
-
paths = paths_for(stem)
|
|
51
|
-
work = build_create_work_payload(raw_detail, workspace=client.workspace, sample_template_id=args.sample_template_id)
|
|
52
|
-
request_url = client._build_url(f"/flow_page_template/{args.sample_template_id}?skip_i18n=true")
|
|
53
|
-
dump_json(paths["raw"], raw_detail)
|
|
54
|
-
dump_json(paths["work"], work)
|
|
55
|
-
write_export_meta(
|
|
56
|
-
paths["meta"],
|
|
57
|
-
stem=stem,
|
|
58
|
-
mode="create",
|
|
59
|
-
workspace=client.workspace,
|
|
60
|
-
template_id=None,
|
|
61
|
-
sample_template_id=args.sample_template_id,
|
|
62
|
-
request_url=request_url,
|
|
63
|
-
raw_path=paths["raw"],
|
|
64
|
-
work_path=paths["work"],
|
|
65
|
-
)
|
|
66
|
-
write_diff(paths["work_diff"], raw_detail, work, "raw", "work")
|
|
67
|
-
else:
|
|
68
|
-
detail_response = client.get_template(args.template_id)
|
|
69
|
-
detail = extract_api_data(detail_response)
|
|
70
|
-
if not isinstance(detail, dict):
|
|
71
|
-
raise SystemExit("template detail must be a JSON object")
|
|
72
|
-
stem = str(args.template_id)
|
|
73
|
-
paths = paths_for(stem)
|
|
74
|
-
work = detail_to_work_payload(detail, workspace=client.workspace, mode="edit")
|
|
75
|
-
request_url = client._build_url(f"/flow_page_template/{args.template_id}?skip_i18n=true")
|
|
76
|
-
dump_json(paths["raw"], detail)
|
|
77
|
-
dump_json(paths["work"], work)
|
|
78
|
-
write_export_meta(
|
|
79
|
-
paths["meta"],
|
|
80
|
-
stem=stem,
|
|
81
|
-
mode="edit",
|
|
82
|
-
workspace=client.workspace,
|
|
83
|
-
template_id=args.template_id,
|
|
84
|
-
sample_template_id=None,
|
|
85
|
-
request_url=request_url,
|
|
86
|
-
raw_path=paths["raw"],
|
|
87
|
-
work_path=paths["work"],
|
|
88
|
-
)
|
|
89
|
-
write_diff(paths["work_diff"], detail, work, "raw", "work")
|
|
90
|
-
|
|
91
|
-
print(paths["raw"])
|
|
92
|
-
print(paths["work"])
|
|
93
|
-
print(paths["meta"])
|
|
94
|
-
print(paths["work_diff"])
|
|
95
|
-
return 0
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if __name__ == "__main__":
|
|
99
|
-
raise SystemExit(main())
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import argparse
|
|
5
|
-
|
|
6
|
-
from console_template_editor_common import (
|
|
7
|
-
dump_json,
|
|
8
|
-
ensure_lint_allowed,
|
|
9
|
-
lint_template_semantics,
|
|
10
|
-
load_json,
|
|
11
|
-
paths_for,
|
|
12
|
-
update_lint_meta,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def build_parser() -> argparse.ArgumentParser:
|
|
17
|
-
p = argparse.ArgumentParser(description="Lint a local BPMAX console template submit payload before confirmation/submission.")
|
|
18
|
-
p.add_argument("--stem", required=True)
|
|
19
|
-
return p
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def main() -> int:
|
|
23
|
-
args = build_parser().parse_args()
|
|
24
|
-
paths = paths_for(args.stem)
|
|
25
|
-
ensure_lint_allowed(paths["meta"], paths["work"], paths["submit"])
|
|
26
|
-
work_payload = load_json(paths["work"])
|
|
27
|
-
raw_payload = load_json(paths["raw"])
|
|
28
|
-
submit_payload = load_json(paths["submit"])
|
|
29
|
-
lint_report = lint_template_semantics(work_payload, raw_payload=raw_payload, submit_payload=submit_payload)
|
|
30
|
-
dump_json(paths["lint"], lint_report)
|
|
31
|
-
update_lint_meta(
|
|
32
|
-
paths["meta"],
|
|
33
|
-
stem=args.stem,
|
|
34
|
-
work_path=paths["work"],
|
|
35
|
-
submit_path=paths["submit"],
|
|
36
|
-
lint_path=paths["lint"],
|
|
37
|
-
lint_report=lint_report,
|
|
38
|
-
)
|
|
39
|
-
print(paths["lint"])
|
|
40
|
-
if not lint_report.get("ok"):
|
|
41
|
-
raise SystemExit("lint failed; inspect lint.json for details")
|
|
42
|
-
return 0
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if __name__ == "__main__":
|
|
46
|
-
raise SystemExit(main())
|
|
@@ -1,99 +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 console-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 console_template_editor_common import (
|
|
15
|
-
build_client,
|
|
16
|
-
build_acceptance_urls,
|
|
17
|
-
build_drift_report,
|
|
18
|
-
dump_json,
|
|
19
|
-
ensure_submission_allowed,
|
|
20
|
-
extract_api_data,
|
|
21
|
-
load_json,
|
|
22
|
-
paths_for,
|
|
23
|
-
record_submission_meta,
|
|
24
|
-
summarize_verification,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def build_parser() -> argparse.ArgumentParser:
|
|
29
|
-
p = argparse.ArgumentParser(description="Submit a local BPMAX console template payload and verify readback.")
|
|
30
|
-
p.add_argument("--stem", required=True)
|
|
31
|
-
p.add_argument("--workspace")
|
|
32
|
-
p.add_argument("--base-url")
|
|
33
|
-
p.add_argument("--language", default="zhCN")
|
|
34
|
-
p.add_argument("--cookie-header")
|
|
35
|
-
p.add_argument("--timeout", type=float, default=30)
|
|
36
|
-
p.add_argument("--insecure", action="store_true")
|
|
37
|
-
return p
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def _resolve_readback_id(meta: dict, response_data: dict) -> int:
|
|
41
|
-
template_id = meta.get("templateId")
|
|
42
|
-
if isinstance(template_id, int):
|
|
43
|
-
return template_id
|
|
44
|
-
candidate = extract_api_data(response_data)
|
|
45
|
-
if isinstance(candidate, dict):
|
|
46
|
-
for key in ("id", "template_id"):
|
|
47
|
-
value = candidate.get(key)
|
|
48
|
-
if isinstance(value, int):
|
|
49
|
-
return value
|
|
50
|
-
if isinstance(value, str) and value.isdigit():
|
|
51
|
-
return int(value)
|
|
52
|
-
raise SystemExit("unable to resolve template id from create response")
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def main() -> int:
|
|
56
|
-
args = build_parser().parse_args()
|
|
57
|
-
client = build_client(args)
|
|
58
|
-
paths = paths_for(args.stem)
|
|
59
|
-
meta = ensure_submission_allowed(paths["meta"], paths["work"], paths["submit"], paths["raw"], paths["lint"])
|
|
60
|
-
submit_payload = load_json(paths["submit"])
|
|
61
|
-
if meta.get("mode") == "create":
|
|
62
|
-
response = client.create_template(submit_payload)
|
|
63
|
-
else:
|
|
64
|
-
template_id = meta.get("templateId")
|
|
65
|
-
if not isinstance(template_id, int):
|
|
66
|
-
raise SystemExit("edit submission requires templateId in meta")
|
|
67
|
-
response = client.update_template(template_id, submit_payload)
|
|
68
|
-
|
|
69
|
-
readback_id = _resolve_readback_id(meta, response)
|
|
70
|
-
readback_response = client.get_template(readback_id)
|
|
71
|
-
readback_detail = extract_api_data(readback_response)
|
|
72
|
-
if not isinstance(readback_detail, dict):
|
|
73
|
-
raise SystemExit("template readback detail must be a JSON object")
|
|
74
|
-
acceptance_urls = build_acceptance_urls(base_url=client.base_url, workspace=client.workspace, template_id=readback_id)
|
|
75
|
-
verify = summarize_verification(submit_payload, readback_detail)
|
|
76
|
-
verify["acceptanceUrls"] = acceptance_urls
|
|
77
|
-
drift = build_drift_report(submit_payload, readback_detail)
|
|
78
|
-
response_output = {
|
|
79
|
-
"response": response,
|
|
80
|
-
"createdTemplateId": readback_id if meta.get("mode") == "create" else None,
|
|
81
|
-
"acceptanceUrls": acceptance_urls,
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
dump_json(paths["response"], response_output)
|
|
85
|
-
dump_json(paths["readback"], readback_detail)
|
|
86
|
-
dump_json(paths["verify"], verify)
|
|
87
|
-
dump_json(paths["drift"], drift)
|
|
88
|
-
record_submission_meta(paths["meta"], stem=args.stem, template_id=readback_id, acceptance_urls=acceptance_urls)
|
|
89
|
-
print(paths["response"])
|
|
90
|
-
print(paths["readback"])
|
|
91
|
-
print(paths["verify"])
|
|
92
|
-
print(paths["drift"])
|
|
93
|
-
if not verify["ok"]:
|
|
94
|
-
raise SystemExit("template readback verification failed; inspect verify.json for mismatches")
|
|
95
|
-
return 0
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if __name__ == "__main__":
|
|
99
|
-
raise SystemExit(main())
|
|
@@ -1,383 +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 console_template_editor_common import ( # noqa: E402
|
|
15
|
-
DEFAULT_BASE_URL,
|
|
16
|
-
build_client,
|
|
17
|
-
build_create_work_payload,
|
|
18
|
-
build_drift_report,
|
|
19
|
-
build_submit_payload,
|
|
20
|
-
canonical_layout_key,
|
|
21
|
-
detail_to_work_payload,
|
|
22
|
-
ensure_build_allowed,
|
|
23
|
-
ensure_lint_allowed,
|
|
24
|
-
ensure_submission_allowed,
|
|
25
|
-
lint_template_semantics,
|
|
26
|
-
load_json,
|
|
27
|
-
summarize_verification,
|
|
28
|
-
update_build_meta,
|
|
29
|
-
update_confirmation_state,
|
|
30
|
-
update_lint_meta,
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def make_detail() -> dict:
|
|
35
|
-
return {
|
|
36
|
-
"id": 954573436,
|
|
37
|
-
"name": "简历看板",
|
|
38
|
-
"desc": "测试看板",
|
|
39
|
-
"data_set_id": 721,
|
|
40
|
-
"search_temp_id": 954573400,
|
|
41
|
-
"type": 4,
|
|
42
|
-
"content": json.dumps(
|
|
43
|
-
{
|
|
44
|
-
"column": 12,
|
|
45
|
-
"layout": [
|
|
46
|
-
{
|
|
47
|
-
"x": 0,
|
|
48
|
-
"y": 0,
|
|
49
|
-
"w": 6,
|
|
50
|
-
"h": 8,
|
|
51
|
-
"i": 1775705110498,
|
|
52
|
-
"name": "图表",
|
|
53
|
-
"freeSize": True,
|
|
54
|
-
"config": {
|
|
55
|
-
"title": "图表一",
|
|
56
|
-
"height": 320,
|
|
57
|
-
"dataSource": "return { driver: 'mysql' };",
|
|
58
|
-
"config": "const cfg = ctx.config || {}; return { title: { text: cfg.title || '图表一' }, series: [] };",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"x": 6,
|
|
63
|
-
"y": 0,
|
|
64
|
-
"w": 6,
|
|
65
|
-
"h": 8,
|
|
66
|
-
"i": "table-1",
|
|
67
|
-
"name": "一般表格",
|
|
68
|
-
"freeSize": True,
|
|
69
|
-
"config": {
|
|
70
|
-
"title": "表格一",
|
|
71
|
-
"height": 320,
|
|
72
|
-
"page_size": "10",
|
|
73
|
-
"exportCount": 10000,
|
|
74
|
-
"dataSource": "return { driver: 'custom_bpmax', script: 'return [];' };",
|
|
75
|
-
"config": "return { data: [], cols: [], pageInfo: { count: 0 } };",
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
ensure_ascii=False,
|
|
81
|
-
),
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class ConsoleTemplateEditorTests(unittest.TestCase):
|
|
86
|
-
def test_detail_to_work_payload_parses_string_content(self) -> None:
|
|
87
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
88
|
-
self.assertEqual(work["id"], 954573436)
|
|
89
|
-
self.assertEqual(work["content"]["column"], 12)
|
|
90
|
-
self.assertEqual(len(work["modules"]), 2)
|
|
91
|
-
self.assertEqual(work["modules"][0]["i"], 1775705110498)
|
|
92
|
-
|
|
93
|
-
def test_build_submit_payload_serializes_content(self) -> None:
|
|
94
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
95
|
-
submit = build_submit_payload(work)
|
|
96
|
-
self.assertEqual(submit["name"], "简历看板")
|
|
97
|
-
self.assertIsInstance(submit["content"], str)
|
|
98
|
-
parsed = json.loads(submit["content"])
|
|
99
|
-
self.assertEqual(parsed["layout"][0]["i"], 1775705110498)
|
|
100
|
-
|
|
101
|
-
def test_default_base_url_is_empty_until_runtime_configured(self) -> None:
|
|
102
|
-
self.assertEqual(DEFAULT_BASE_URL, "")
|
|
103
|
-
|
|
104
|
-
def test_build_client_uses_environment_origin_without_api_suffix(self) -> None:
|
|
105
|
-
args = type(
|
|
106
|
-
"Args",
|
|
107
|
-
(),
|
|
108
|
-
{
|
|
109
|
-
"base_url": None,
|
|
110
|
-
"workspace": "store_mgr",
|
|
111
|
-
"language": "zhCN",
|
|
112
|
-
"cookie_header": "token=demo",
|
|
113
|
-
"timeout": 30,
|
|
114
|
-
"insecure": False,
|
|
115
|
-
},
|
|
116
|
-
)()
|
|
117
|
-
with mock.patch.dict(os.environ, {"BPMAX_BASE_URL": "https://bpmax.example.com/"}, clear=False):
|
|
118
|
-
client = build_client(args)
|
|
119
|
-
self.assertEqual(
|
|
120
|
-
client._build_url("/flow_page_template/954573436?skip_i18n=true"),
|
|
121
|
-
"https://bpmax.example.com/flow_page_template/954573436?skip_i18n=true&$workspace=store_mgr&$language=zhCN",
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
def test_build_client_requires_runtime_origin_when_not_explicitly_configured(self) -> None:
|
|
125
|
-
args = type(
|
|
126
|
-
"Args",
|
|
127
|
-
(),
|
|
128
|
-
{
|
|
129
|
-
"base_url": None,
|
|
130
|
-
"workspace": "store_mgr",
|
|
131
|
-
"language": "zhCN",
|
|
132
|
-
"cookie_header": "token=demo",
|
|
133
|
-
"timeout": 30,
|
|
134
|
-
"insecure": False,
|
|
135
|
-
},
|
|
136
|
-
)()
|
|
137
|
-
with mock.patch.dict(os.environ, {}, clear=True):
|
|
138
|
-
with self.assertRaises(SystemExit) as ctx:
|
|
139
|
-
build_client(args)
|
|
140
|
-
self.assertIn("BPMAX_BASE_URL", str(ctx.exception))
|
|
141
|
-
|
|
142
|
-
def test_canonical_layout_key_supports_numeric_values(self) -> None:
|
|
143
|
-
self.assertEqual(canonical_layout_key(1775705110498), "1775705110498")
|
|
144
|
-
|
|
145
|
-
def test_build_requires_work_confirmation(self) -> None:
|
|
146
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
147
|
-
root = Path(tmpdir)
|
|
148
|
-
meta_path = root / "meta.json"
|
|
149
|
-
work_path = root / "work.json"
|
|
150
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
151
|
-
work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
|
|
152
|
-
meta_path.write_text(
|
|
153
|
-
json.dumps({"stem": "954573436", "status": "exported", "workSha256": "old"}, ensure_ascii=False),
|
|
154
|
-
encoding="utf-8",
|
|
155
|
-
)
|
|
156
|
-
with self.assertRaises(SystemExit):
|
|
157
|
-
ensure_build_allowed(meta_path, work_path)
|
|
158
|
-
|
|
159
|
-
def test_submit_requires_submit_confirmation(self) -> None:
|
|
160
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
161
|
-
root = Path(tmpdir)
|
|
162
|
-
raw_path = root / "raw.json"
|
|
163
|
-
work_path = root / "work.json"
|
|
164
|
-
submit_path = root / "submit.json"
|
|
165
|
-
lint_path = root / "lint.json"
|
|
166
|
-
meta_path = root / "meta.json"
|
|
167
|
-
detail = make_detail()
|
|
168
|
-
work = detail_to_work_payload(detail, workspace="store_mgr", mode="edit")
|
|
169
|
-
submit = build_submit_payload(work)
|
|
170
|
-
lint = lint_template_semantics(work, raw_payload=detail, submit_payload=submit)
|
|
171
|
-
raw_path.write_text(json.dumps(detail, ensure_ascii=False), encoding="utf-8")
|
|
172
|
-
work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
|
|
173
|
-
submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
|
|
174
|
-
lint_path.write_text(json.dumps(lint, ensure_ascii=False), encoding="utf-8")
|
|
175
|
-
meta_path.write_text(
|
|
176
|
-
json.dumps(
|
|
177
|
-
{
|
|
178
|
-
"stem": "954573436",
|
|
179
|
-
"mode": "edit",
|
|
180
|
-
"workspace": "store_mgr",
|
|
181
|
-
"status": "submit_built",
|
|
182
|
-
"workSha256": __import__("hashlib").sha256(work_path.read_bytes()).hexdigest(),
|
|
183
|
-
"submitSha256": __import__("hashlib").sha256(submit_path.read_bytes()).hexdigest(),
|
|
184
|
-
"workConfirmedAt": "2026-04-21T00:00:00+00:00",
|
|
185
|
-
"lintCheckedAt": "2026-04-21T00:00:30+00:00",
|
|
186
|
-
"lintOk": True,
|
|
187
|
-
"lintWorkSha256": __import__("hashlib").sha256(work_path.read_bytes()).hexdigest(),
|
|
188
|
-
"lintSubmitSha256": __import__("hashlib").sha256(submit_path.read_bytes()).hexdigest(),
|
|
189
|
-
},
|
|
190
|
-
ensure_ascii=False,
|
|
191
|
-
),
|
|
192
|
-
encoding="utf-8",
|
|
193
|
-
)
|
|
194
|
-
with self.assertRaises(SystemExit):
|
|
195
|
-
ensure_submission_allowed(meta_path, work_path, submit_path, raw_path, lint_path)
|
|
196
|
-
|
|
197
|
-
def test_edit_mode_preserves_unmodified_modules(self) -> None:
|
|
198
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
199
|
-
submit = build_submit_payload(work)
|
|
200
|
-
content = json.loads(submit["content"])
|
|
201
|
-
self.assertEqual([item["i"] for item in content["layout"]], [1775705110498, "table-1"])
|
|
202
|
-
|
|
203
|
-
def test_removed_layout_item_is_not_in_submit(self) -> None:
|
|
204
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
205
|
-
work["removedLayoutItems"] = [1775705110498]
|
|
206
|
-
submit = build_submit_payload(work)
|
|
207
|
-
content = json.loads(submit["content"])
|
|
208
|
-
self.assertEqual([item["i"] for item in content["layout"]], ["table-1"])
|
|
209
|
-
|
|
210
|
-
def test_create_skeleton_drops_edit_only_identity(self) -> None:
|
|
211
|
-
work = build_create_work_payload(make_detail(), workspace="store_mgr", sample_template_id=954573436)
|
|
212
|
-
self.assertIsNone(work["id"])
|
|
213
|
-
self.assertEqual(work["mode"], "create")
|
|
214
|
-
self.assertEqual(work["sampleTemplateId"], 954573436)
|
|
215
|
-
submit = build_submit_payload(work)
|
|
216
|
-
self.assertEqual(submit["status"], 0)
|
|
217
|
-
|
|
218
|
-
def test_build_meta_invalidates_old_confirmation_after_work_change(self) -> None:
|
|
219
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
220
|
-
root = Path(tmpdir)
|
|
221
|
-
meta_path = root / "meta.json"
|
|
222
|
-
work_path = root / "work.json"
|
|
223
|
-
submit_path = root / "submit.json"
|
|
224
|
-
work_path.write_text(json.dumps({"name": "v1"}, ensure_ascii=False), encoding="utf-8")
|
|
225
|
-
submit_path.write_text(json.dumps({"name": "s1"}, ensure_ascii=False), encoding="utf-8")
|
|
226
|
-
meta_path.write_text(
|
|
227
|
-
json.dumps(
|
|
228
|
-
{
|
|
229
|
-
"stem": "954573436",
|
|
230
|
-
"mode": "edit",
|
|
231
|
-
"workspace": "store_mgr",
|
|
232
|
-
"workSha256": "old",
|
|
233
|
-
"status": "submit_confirmed",
|
|
234
|
-
"workConfirmedAt": "2026-04-21T00:00:00+00:00",
|
|
235
|
-
"submitConfirmedAt": "2026-04-21T00:01:00+00:00",
|
|
236
|
-
},
|
|
237
|
-
ensure_ascii=False,
|
|
238
|
-
),
|
|
239
|
-
encoding="utf-8",
|
|
240
|
-
)
|
|
241
|
-
update_build_meta(meta_path, stem="954573436", work_path=work_path, submit_path=submit_path)
|
|
242
|
-
meta = load_json(meta_path)
|
|
243
|
-
self.assertIsNone(meta["workConfirmedAt"])
|
|
244
|
-
self.assertIsNone(meta["submitConfirmedAt"])
|
|
245
|
-
self.assertEqual(meta["status"], "submit_built")
|
|
246
|
-
|
|
247
|
-
def test_two_stage_confirmation_flow(self) -> None:
|
|
248
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
249
|
-
root = Path(tmpdir)
|
|
250
|
-
meta_path = root / "meta.json"
|
|
251
|
-
work_path = root / "work.json"
|
|
252
|
-
submit_path = root / "submit.json"
|
|
253
|
-
lint_path = root / "lint.json"
|
|
254
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
255
|
-
submit = build_submit_payload(work)
|
|
256
|
-
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=submit)
|
|
257
|
-
work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
|
|
258
|
-
submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
|
|
259
|
-
lint_path.write_text(json.dumps(lint, ensure_ascii=False), encoding="utf-8")
|
|
260
|
-
update_confirmation_state(meta_path, stem="954573436", actor="tester", stage="work", work_path=work_path)
|
|
261
|
-
meta = load_json(meta_path)
|
|
262
|
-
self.assertEqual(meta["status"], "work_confirmed")
|
|
263
|
-
ensure_build_allowed(meta_path, work_path)
|
|
264
|
-
update_build_meta(meta_path, stem="954573436", work_path=work_path, submit_path=submit_path)
|
|
265
|
-
ensure_lint_allowed(meta_path, work_path, submit_path)
|
|
266
|
-
update_lint_meta(
|
|
267
|
-
meta_path,
|
|
268
|
-
stem="954573436",
|
|
269
|
-
work_path=work_path,
|
|
270
|
-
submit_path=submit_path,
|
|
271
|
-
lint_path=lint_path,
|
|
272
|
-
lint_report=lint,
|
|
273
|
-
)
|
|
274
|
-
update_confirmation_state(
|
|
275
|
-
meta_path,
|
|
276
|
-
stem="954573436",
|
|
277
|
-
actor="tester",
|
|
278
|
-
stage="submit",
|
|
279
|
-
work_path=work_path,
|
|
280
|
-
submit_path=submit_path,
|
|
281
|
-
)
|
|
282
|
-
meta = load_json(meta_path)
|
|
283
|
-
self.assertEqual(meta["status"], "submit_confirmed")
|
|
284
|
-
|
|
285
|
-
def test_lint_rejects_chart_without_ctx_config_fallback(self) -> None:
|
|
286
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
287
|
-
work["modules"][0]["config"]["config"] = "return { title: { text: ctx.config.title }, series: [] };"
|
|
288
|
-
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
289
|
-
self.assertFalse(lint["ok"])
|
|
290
|
-
self.assertTrue(any("ctx.config without fallback" in err for err in lint["errors"]))
|
|
291
|
-
|
|
292
|
-
def test_lint_rejects_custom_bpmax_frontend_placeholders(self) -> None:
|
|
293
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
294
|
-
work["modules"][1]["config"]["dataSource"] = "return { driver: 'custom_bpmax', script: '${page_size}' };"
|
|
295
|
-
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
296
|
-
self.assertFalse(lint["ok"])
|
|
297
|
-
self.assertTrue(any("${page_size}" in err for err in lint["errors"]))
|
|
298
|
-
|
|
299
|
-
def test_lint_blocks_project_list_in_module_script(self) -> None:
|
|
300
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
301
|
-
work["modules"][0]["config"]["dataSource"] = (
|
|
302
|
-
"return ctx.$axios.post('/bpmax/project/list?page=1', { flow_type: 'flow764', query: {} });"
|
|
303
|
-
)
|
|
304
|
-
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
305
|
-
self.assertFalse(lint["ok"])
|
|
306
|
-
self.assertTrue(any("project/list" in err for err in lint["errors"]))
|
|
307
|
-
|
|
308
|
-
def test_lint_warns_table_export_when_config_only_uses_page_size(self) -> None:
|
|
309
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
310
|
-
work["modules"][1]["config"]["config"] = (
|
|
311
|
-
"const cfg = ctx.config || {}; "
|
|
312
|
-
"const pageSize = cfg.page_size || 20; "
|
|
313
|
-
"return { data: rows.slice(0, pageSize), cols: [], pageInfo: { count: rows.length } };"
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
317
|
-
|
|
318
|
-
self.assertTrue(lint["ok"])
|
|
319
|
-
self.assertTrue(any("TableSmart export" in warning for warning in lint["warnings"]))
|
|
320
|
-
|
|
321
|
-
def test_lint_blocks_empty_flow_binding_for_no_flow_console_list_visibility(self) -> None:
|
|
322
|
-
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
323
|
-
submit = build_submit_payload(work)
|
|
324
|
-
submit["flow_type"] = ""
|
|
325
|
-
submit["flow_key"] = ""
|
|
326
|
-
|
|
327
|
-
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=submit)
|
|
328
|
-
|
|
329
|
-
self.assertFalse(lint["ok"])
|
|
330
|
-
self.assertTrue(any("flow_type/flow_key" in err for err in lint["errors"]))
|
|
331
|
-
self.assertFalse(lint["checks"]["consoleListVisibility"]["visibleInNoFlowConsoleList"])
|
|
332
|
-
|
|
333
|
-
def test_lint_result_must_be_refreshed_after_submit_changes(self) -> None:
|
|
334
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
335
|
-
root = Path(tmpdir)
|
|
336
|
-
meta_path = root / "meta.json"
|
|
337
|
-
work_path = root / "work.json"
|
|
338
|
-
submit_path = root / "submit.json"
|
|
339
|
-
lint_path = root / "lint.json"
|
|
340
|
-
raw_path = root / "raw.json"
|
|
341
|
-
detail = make_detail()
|
|
342
|
-
work = detail_to_work_payload(detail, workspace="store_mgr", mode="edit")
|
|
343
|
-
submit = build_submit_payload(work)
|
|
344
|
-
lint = lint_template_semantics(work, raw_payload=detail, submit_payload=submit)
|
|
345
|
-
raw_path.write_text(json.dumps(detail, ensure_ascii=False), encoding="utf-8")
|
|
346
|
-
work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
|
|
347
|
-
submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
|
|
348
|
-
lint_path.write_text(json.dumps(lint, ensure_ascii=False), encoding="utf-8")
|
|
349
|
-
update_confirmation_state(meta_path, stem="954573436", actor="tester", stage="work", work_path=work_path)
|
|
350
|
-
update_build_meta(meta_path, stem="954573436", work_path=work_path, submit_path=submit_path)
|
|
351
|
-
update_lint_meta(
|
|
352
|
-
meta_path,
|
|
353
|
-
stem="954573436",
|
|
354
|
-
work_path=work_path,
|
|
355
|
-
submit_path=submit_path,
|
|
356
|
-
lint_path=lint_path,
|
|
357
|
-
lint_report=lint,
|
|
358
|
-
)
|
|
359
|
-
update_confirmation_state(
|
|
360
|
-
meta_path,
|
|
361
|
-
stem="954573436",
|
|
362
|
-
actor="tester",
|
|
363
|
-
stage="submit",
|
|
364
|
-
work_path=work_path,
|
|
365
|
-
submit_path=submit_path,
|
|
366
|
-
)
|
|
367
|
-
submit["desc"] = "changed"
|
|
368
|
-
submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
|
|
369
|
-
with self.assertRaises(SystemExit):
|
|
370
|
-
ensure_submission_allowed(meta_path, work_path, submit_path, raw_path, lint_path)
|
|
371
|
-
|
|
372
|
-
def test_verification_and_drift_report(self) -> None:
|
|
373
|
-
detail = make_detail()
|
|
374
|
-
submit = build_submit_payload(detail_to_work_payload(detail, workspace="store_mgr", mode="edit"))
|
|
375
|
-
readback = dict(detail)
|
|
376
|
-
verify = summarize_verification(submit, readback)
|
|
377
|
-
drift = build_drift_report(submit, readback)
|
|
378
|
-
self.assertTrue(verify["ok"])
|
|
379
|
-
self.assertTrue(drift["ok"])
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
if __name__ == "__main__":
|
|
383
|
-
unittest.main()
|