bpmax-cli 0.1.42 → 0.1.44-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/bin.js +3967 -533
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-api-platform-editor/SKILL.md +321 -0
- package/skills/bpmax-api-platform-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-api-platform-editor/references/api-doc-debug-workflow.md +34 -0
- package/skills/bpmax-api-platform-editor/references/api-proxy-shape.md +41 -0
- package/skills/bpmax-api-platform-editor/references/instance-config-shape.md +41 -0
- package/skills/bpmax-api-platform-editor/references/platform-api-map.md +52 -0
- package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +32 -0
- package/skills/bpmax-api-platform-editor/scripts/api_platform_editor_common.py +1276 -0
- package/skills/bpmax-api-platform-editor/scripts/build_submit_payload.py +64 -0
- package/skills/bpmax-api-platform-editor/scripts/capture_write_contract.py +40 -0
- package/skills/bpmax-api-platform-editor/scripts/export_layer_bundle.py +212 -0
- package/skills/bpmax-api-platform-editor/scripts/record_doc_debug_acceptance.py +62 -0
- package/skills/bpmax-api-platform-editor/scripts/submit_and_verify_layer.py +75 -0
- package/skills/bpmax-api-platform-editor/tests/test_api_platform_editor.py +287 -0
- package/skills/bpmax-auth/SKILL.md +6 -17
- package/skills/bpmax-builder-shared/SKILL.md +44 -0
- package/skills/bpmax-builder-shared/base_url.py +81 -0
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.json +71 -0
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.md +34 -0
- package/skills/bpmax-builder-shared/runtime-script-template-catalog.md +123 -0
- package/skills/bpmax-builder-shared/runtime_script_rules.py +272 -0
- package/skills/bpmax-builder-shared/skill_audit.py +374 -0
- package/skills/bpmax-builder-shared/template_script_hard_rules.py +280 -0
- package/skills/bpmax-builder-shared/tests/test_base_url.py +80 -0
- package/skills/bpmax-builder-shared/tests/test_runtime_script_rules.py +115 -0
- package/skills/bpmax-builder-shared/tests/test_skill_audit.py +231 -0
- package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +281 -0
- package/skills/bpmax-cli/SKILL.md +2 -0
- package/skills/bpmax-config-latest/SKILL.md +71 -0
- package/skills/bpmax-console-template-editor/SKILL.md +536 -0
- package/skills/bpmax-console-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-console-template-editor/references/filter-integration.md +60 -0
- package/skills/bpmax-console-template-editor/references/lessons-from-resume-dashboard.md +114 -0
- package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +69 -0
- package/skills/bpmax-console-template-editor/references/module-catalog.md +100 -0
- package/skills/bpmax-console-template-editor/references/runtime-page-shape.md +91 -0
- package/skills/bpmax-console-template-editor/references/template-shape.md +149 -0
- package/skills/bpmax-console-template-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-console-template-editor/scripts/confirm_console_template.py +33 -0
- package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +964 -0
- package/skills/bpmax-console-template-editor/scripts/export_console_template.py +99 -0
- package/skills/bpmax-console-template-editor/scripts/lint_console_template.py +46 -0
- package/skills/bpmax-console-template-editor/scripts/submit_console_template.py +99 -0
- package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +383 -0
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +600 -0
- package/skills/bpmax-dataset-field-template-editor/references/create-request-gotchas.md +25 -0
- package/skills/bpmax-dataset-field-template-editor/references/field-classify-mapping.md +35 -0
- package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +24 -0
- package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +61 -0
- package/skills/bpmax-dataset-field-template-editor/references/virtual-field-patterns.md +27 -0
- package/skills/bpmax-dataset-field-template-editor/references/work-file-to-submit-mapping.md +127 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/build_submit_payload.py +67 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/confirm_dataset_field.py +37 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +784 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +62 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +104 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +83 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/lint_dataset_field_semantics.py +35 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +95 -0
- package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +709 -0
- package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +59 -0
- package/skills/bpmax-dataset-template-editor/SKILL.md +779 -0
- package/skills/bpmax-dataset-template-editor/references/custom-key-usage-patterns.md +18 -0
- package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +73 -0
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-authoring-guide.md +186 -0
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-example-catalog.md +106 -0
- package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +28 -0
- package/skills/bpmax-dataset-template-editor/references/runtime-verified-dataset-page-shape.md +47 -0
- package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +23 -0
- package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +97 -0
- package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +65 -0
- package/skills/bpmax-dataset-template-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +650 -0
- package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +155 -0
- package/skills/bpmax-dataset-template-editor/scripts/lint_dataset_template.py +42 -0
- package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +43 -0
- package/skills/bpmax-dataset-template-editor/scripts/scan_custom_key_references.py +27 -0
- package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +115 -0
- package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +52 -0
- package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +39 -0
- package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +373 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +151 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +4 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +60 -0
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +371 -0
- package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +5 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json +97 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_final_v2.json +105 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_main.json +36 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_region.json +40 -0
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +33 -0
- package/skills/bpmax-e2e-flow-test-operator/references/failure-update-loop.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator/references/filter-field-discovery.md +40 -0
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +19 -0
- package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +75 -0
- package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +107 -0
- package/skills/bpmax-e2e-flow-test-operator/references/skill-experience-coverage-matrix.md +29 -0
- package/skills/bpmax-e2e-flow-test-operator/references/stale-runtime-and-clean-sample-rules.md +54 -0
- package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +58 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/bpmax_session.py +287 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_plan.json +59 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_runner.py +687 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +95 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +288 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_api_matrix.py +161 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_filter_fields.py +138 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_form_runtime.py +396 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +341 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_test_profile.py +185 -0
- package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +138 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/SKILL.md +69 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-checklist.md +42 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-recipes.md +38 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-shape.md +86 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/gate-lint.md +68 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/hoocoo-patterns.md +39 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/runtime-behavior.md +41 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/script-authoring.md +110 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/scripts/lint_feishu_chat_plugin.py +278 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/tests/test_lint_feishu_chat_plugin.py +203 -0
- package/skills/bpmax-filter-template-editor/SKILL.md +564 -0
- package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +38 -0
- package/skills/bpmax-filter-template-editor/references/filter-and-flow-binding.md +57 -0
- package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +141 -0
- package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +287 -0
- package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +115 -0
- package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +94 -0
- package/skills/bpmax-filter-template-editor/scripts/build_submit_payload.py +25 -0
- package/skills/bpmax-filter-template-editor/scripts/confirm_filter_template.py +22 -0
- package/skills/bpmax-filter-template-editor/scripts/export_filter_template.py +57 -0
- package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +348 -0
- package/skills/bpmax-filter-template-editor/scripts/init_create_filter_template.py +8 -0
- package/skills/bpmax-filter-template-editor/scripts/lint_filter_template_semantics.py +26 -0
- package/skills/bpmax-filter-template-editor/scripts/submit_filter_template.py +62 -0
- package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +231 -0
- package/skills/bpmax-flow-template-editor/SKILL.md +1043 -0
- package/skills/bpmax-flow-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-flow-template-editor/references/before-next-step-script-runtime-gotchas.md +62 -0
- package/skills/bpmax-flow-template-editor/references/config-surfaces-and-placeholders.md +270 -0
- package/skills/bpmax-flow-template-editor/references/diff-strategy.md +67 -0
- package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +25 -0
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +159 -0
- package/skills/bpmax-flow-template-editor/references/intent-model.md +117 -0
- package/skills/bpmax-flow-template-editor/references/lessons-from-price-plan-flow.md +147 -0
- package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +97 -0
- package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +163 -0
- package/skills/bpmax-flow-template-editor/references/payload-checklist.md +133 -0
- package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +54 -0
- package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +149 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +41 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +155 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +179 -0
- package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +91 -0
- package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +93 -0
- package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +57 -0
- package/skills/bpmax-flow-template-editor/scripts/build_submit_payload.py +69 -0
- package/skills/bpmax-flow-template-editor/scripts/confirm_flow_template.py +52 -0
- package/skills/bpmax-flow-template-editor/scripts/export_flow_template.py +114 -0
- package/skills/bpmax-flow-template-editor/scripts/flow_template_editor_common.py +1084 -0
- package/skills/bpmax-flow-template-editor/scripts/submit_flow_template.py +159 -0
- package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +636 -0
- package/skills/bpmax-form-template-editor/SKILL.md +1074 -0
- package/skills/bpmax-form-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +193 -0
- package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +125 -0
- package/skills/bpmax-form-template-editor/references/payload-checklist.md +77 -0
- package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +49 -0
- package/skills/bpmax-form-template-editor/scripts/build_submit_payload.py +37 -0
- package/skills/bpmax-form-template-editor/scripts/check_form_template_consistency.py +145 -0
- package/skills/bpmax-form-template-editor/scripts/confirm_form_template.py +67 -0
- package/skills/bpmax-form-template-editor/scripts/export_form_template.py +89 -0
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +1745 -0
- package/skills/bpmax-form-template-editor/scripts/lint_form_template_semantics.py +30 -0
- package/skills/bpmax-form-template-editor/scripts/record_runtime_acceptance.py +67 -0
- package/skills/bpmax-form-template-editor/scripts/submit_form_template.py +163 -0
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +1303 -0
- package/skills/bpmax-list-template-editor/SKILL.md +468 -0
- package/skills/bpmax-list-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-list-template-editor/references/browser-page-contract.md +81 -0
- package/skills/bpmax-list-template-editor/references/content-config-shape.md +148 -0
- package/skills/bpmax-list-template-editor/references/dataset-field-mapping.md +60 -0
- package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +103 -0
- package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +102 -0
- package/skills/bpmax-list-template-editor/references/payload-checklist.md +47 -0
- package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +140 -0
- package/skills/bpmax-list-template-editor/references/special-formats.md +394 -0
- package/skills/bpmax-list-template-editor/scripts/build_submit_payload.py +37 -0
- package/skills/bpmax-list-template-editor/scripts/confirm_list_template.py +33 -0
- package/skills/bpmax-list-template-editor/scripts/export_list_template.py +89 -0
- package/skills/bpmax-list-template-editor/scripts/fetch_data_set.py +34 -0
- package/skills/bpmax-list-template-editor/scripts/lint_list_template_semantics.py +54 -0
- package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +955 -0
- package/skills/bpmax-list-template-editor/scripts/record_acceptance.py +55 -0
- package/skills/bpmax-list-template-editor/scripts/submit_list_template.py +117 -0
- package/skills/bpmax-list-template-editor/tests/test_list_template_editor_common.py +441 -0
- package/skills/bpmax-nav-config-editor/SKILL.md +347 -0
- package/skills/bpmax-nav-config-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +68 -0
- package/skills/bpmax-nav-config-editor/references/config-shape.md +78 -0
- package/skills/bpmax-nav-config-editor/references/icon-selection.md +83 -0
- package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +46 -0
- package/skills/bpmax-nav-config-editor/references/payload-checklist.md +41 -0
- package/skills/bpmax-nav-config-editor/references/runtime-probing.md +47 -0
- package/skills/bpmax-nav-config-editor/scripts/build_submit_payload.py +34 -0
- package/skills/bpmax-nav-config-editor/scripts/confirm_nav_config.py +32 -0
- package/skills/bpmax-nav-config-editor/scripts/export_nav_config.py +56 -0
- package/skills/bpmax-nav-config-editor/scripts/lint_nav_config_semantics.py +33 -0
- package/skills/bpmax-nav-config-editor/scripts/nav_config_editor_common.py +812 -0
- package/skills/bpmax-nav-config-editor/scripts/submit_nav_config.py +44 -0
- package/skills/bpmax-nav-config-editor/scripts/verify_nav_config.py +33 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor.py +358 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor_common.py +138 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_lint.py +58 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_submit_verify.py +51 -0
- package/skills/bpmax-project/SKILL.md +1 -1
- package/skills/bpmax-project-detail-template-editor/SKILL.md +329 -0
- package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-project-detail-template-editor/references/local-temp-workflow.md +59 -0
- package/skills/bpmax-project-detail-template-editor/references/module-catalog-and-config-notes.md +47 -0
- package/skills/bpmax-project-detail-template-editor/references/payload-checklist.md +33 -0
- package/skills/bpmax-project-detail-template-editor/references/project-detail-template-api-workflow.md +44 -0
- package/skills/bpmax-project-detail-template-editor/scripts/build_submit_payload.py +30 -0
- package/skills/bpmax-project-detail-template-editor/scripts/confirm_project_detail_template.py +33 -0
- package/skills/bpmax-project-detail-template-editor/scripts/export_project_detail_template.py +87 -0
- package/skills/bpmax-project-detail-template-editor/scripts/lint_project_detail_template_semantics.py +37 -0
- package/skills/bpmax-project-detail-template-editor/scripts/project_detail_template_editor_common.py +507 -0
- package/skills/bpmax-project-detail-template-editor/scripts/submit_project_detail_template.py +120 -0
- package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py +369 -0
- package/skills/bpmax-role-editor/SKILL.md +251 -0
- package/skills/bpmax-role-editor/references/api-workflow.md +30 -0
- package/skills/bpmax-role-editor/references/runtime-page-shape.md +18 -0
- package/skills/bpmax-role-editor/references/work-file-mapping.md +32 -0
- package/skills/bpmax-role-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-role-editor/scripts/confirm_role.py +33 -0
- package/skills/bpmax-role-editor/scripts/export_role.py +163 -0
- package/skills/bpmax-role-editor/scripts/lint_role_semantics.py +38 -0
- package/skills/bpmax-role-editor/scripts/role_editor_common.py +1231 -0
- package/skills/bpmax-role-editor/scripts/submit_role.py +144 -0
- package/skills/bpmax-role-editor/tests/test_role_editor.py +343 -0
- package/skills/bpmax-shared/SKILL.md +1 -1
- package/skills/form-control-library/SKILL.md +82 -0
- package/skills/form-control-library/agents/openai.yaml +4 -0
- package/skills/form-control-library/references/form-controls.md +199 -0
- package/skills/form-control-library/references/form-template-submit-schema.md +180 -0
- package/skills/form-control-library/references/group-select-runtime.md +191 -0
- package/skills/form-control-library/scripts/rebuild_form_control_library.py +55 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "bpmax-role-editor"
|
|
3
|
+
description: "用于在 BPMAX 的角色配置页面创建或编辑角色。只要用户提到“配角色”“编辑角色权限”“新增角色”“改系统权限/自定义权限/流程权限/成员管理”“从当前浏览器角色页直接提交角色配置”或等价表达,就应使用这个 skill。它复用当前浏览器登录态和真实线上接口,走本地临时文件 + gate 检查 + typed CLI submit + 回读验收的闭环。"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# BPMAX Role Editor
|
|
7
|
+
|
|
8
|
+
## 写入路径硬约束
|
|
9
|
+
- 执行前必须先运行 `bpmax-cli config adapters --format json` 核对 `role`;只有 `build_status` 和 `submit_status` 都是 `supported` 时才允许进入 build/submit。当前若显示 `blocked`,只能导出、编辑 work、lint 和形成变更建议,不得提交。
|
|
10
|
+
- 在 bpmax-cli npm 分发包中,真实远端写操作只能走 `bpmax-cli config role submit`。
|
|
11
|
+
- 旧来源脚本 `scripts/submit*.py` 只保留为结构参考,默认会硬失败;不得用它们直调 BPMAX API。
|
|
12
|
+
- 不得用 `bpmax-cli api POST/PUT/DELETE /role*` 或其它 raw API 绕过 typed config submit。
|
|
13
|
+
|
|
14
|
+
## 全局范围门禁
|
|
15
|
+
- 范围 gate 对本 skill 是强要求。任何会修改 BPMAX 配置、线上状态、本地提交体或最终结果的动作,都必须先归类为 `requested`、`required-collateral` 或 `out-of-scope`。
|
|
16
|
+
- 范围 gate 必须基于线上最新配置:分析或编辑配置前,先通过对应 workflow/API 拉取或读取远端最新状态;提交前再次确认本地 work/submit/payload 仍基于该最新远端基线,若线上配置已变化必须停止并重新对照。
|
|
17
|
+
- 只有用户明确要求的 `requested`,或为闭合需求不可避免的 `required-collateral`,才允许进入 work / submit / 线上 payload / 状态变更。
|
|
18
|
+
- `required-collateral` 必须逐项解释“不改会坏/会失真/会不闭合”的原因并取得确认;`out-of-scope` 一律不得提交或顺手混入。
|
|
19
|
+
- 不得以历史脏配置、顺手修复、统一风格、编辑器自动补字段、方便调试为理由修改需求外配置。
|
|
20
|
+
|
|
21
|
+
## 何时使用
|
|
22
|
+
- 用户已经在浏览器打开 BPMAX 角色页:`.../w:<workspace>/role`
|
|
23
|
+
- 用户要新建角色或编辑已有角色
|
|
24
|
+
- 用户要调整:
|
|
25
|
+
- 角色基础信息
|
|
26
|
+
- 可见范围
|
|
27
|
+
- 系统权限
|
|
28
|
+
- 自定义权限
|
|
29
|
+
- 流程权限
|
|
30
|
+
- 成员管理
|
|
31
|
+
|
|
32
|
+
## 核心原则
|
|
33
|
+
- 只通过 `bpmax-cli config role submit` 提交,不把页面手点保存或旧脚本当主路径。
|
|
34
|
+
- 默认主流程固定为:
|
|
35
|
+
- 导出线上数据到 `.codex/tmp/role-editor/`
|
|
36
|
+
- 修改 `work/<stem>.json`
|
|
37
|
+
- 第一次确认
|
|
38
|
+
- 构建 `submit/<stem>.json`
|
|
39
|
+
- lint
|
|
40
|
+
- 第二次确认
|
|
41
|
+
- 提交
|
|
42
|
+
- 接口回读
|
|
43
|
+
- 浏览器刷新角色页验收
|
|
44
|
+
- v1 不做角色删除。
|
|
45
|
+
- 只允许人工修改 `work/<stem>.json`,不要直接改 `raw`、`submit` 或仓库镜像。
|
|
46
|
+
- `permissions` 必须始终保持四段结构:
|
|
47
|
+
- `system`
|
|
48
|
+
- `custom`
|
|
49
|
+
- `flow`
|
|
50
|
+
- `workspace`
|
|
51
|
+
- `visibleScope.mode` 固定映射:
|
|
52
|
+
- `all -> team.all`
|
|
53
|
+
- `self -> team.self`
|
|
54
|
+
- `custom -> team.specify_team_and_user`
|
|
55
|
+
- 列表权限分层固定为:
|
|
56
|
+
- `project.list.*` / `admin.project.list.*` / 流程权限:表达通用列表范围
|
|
57
|
+
- `visible_scope`:表达角色默认可见范围
|
|
58
|
+
- `pre_process_script`:只处理业务字段归属、身份映射、跨数据集联动这类通用权限点表达不了的特殊数据可见性
|
|
59
|
+
- 流程权限 key 固定规则:
|
|
60
|
+
- `default` 流程:`default:<flow_key>`
|
|
61
|
+
- 其他流程:`<flow_type>:`
|
|
62
|
+
- 工作区权限挂在 `permissions.workspace[workspace_key]`
|
|
63
|
+
- `customPoints` 和 `members` 都使用显式 delta:
|
|
64
|
+
- `customPoints.upserts/deletes`
|
|
65
|
+
- `members.addUserIds/removeUserRoleIds`
|
|
66
|
+
- 不要把“入口能不能看到”“筛选器默认条件”误当成角色列表权限;涉及服务端特殊数据可见性时,跳转到 [`bpmax-dataset-template-editor`](../bpmax-dataset-template-editor/SKILL.md) 的 `pre_process_script` 方法。
|
|
67
|
+
|
|
68
|
+
## 前置条件
|
|
69
|
+
- 用户应先打开角色页,优先让当前浏览器上下文提供:
|
|
70
|
+
- `document.cookie`
|
|
71
|
+
- 当前 origin
|
|
72
|
+
- 当前工作区
|
|
73
|
+
- 默认环境变量:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export BPMAX_BASE_URL='https://<current-browser-origin>'
|
|
77
|
+
export BPMAX_COOKIE_HEADER='foo=bar; baz=qux'
|
|
78
|
+
export BPMAX_WORKSPACE='store_mgr'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- `BPMAX_BASE_URL` 优先使用当前浏览器页面 origin;如果没有显式提供,bpmax-builder-shared `base_url` 会按 [AGENTS.md](../../../AGENTS.md) 里的仓库默认 origin 兜底。
|
|
82
|
+
- 不要在 skill 文档或脚本里再写死任何项目环境域名。
|
|
83
|
+
|
|
84
|
+
## Mem0 协议
|
|
85
|
+
- 开始前先调用 `mem0-memory-protocol`,检索词至少包含:
|
|
86
|
+
- `workspace`
|
|
87
|
+
- 角色 `id` / `key` / `name`
|
|
88
|
+
- `system/custom/flow/member`
|
|
89
|
+
- 优先查:
|
|
90
|
+
- 这个角色之前的保存坑点
|
|
91
|
+
- 同工作区下权限 key 的复用约束
|
|
92
|
+
- 是否有已知 point/category 写法
|
|
93
|
+
- 成功提交并完成回读后,再写回真正可复用的结论:
|
|
94
|
+
- `decision`:角色权限结构、visible_scope 约束、流程权限 key 规则
|
|
95
|
+
- `task_learning`:某类角色改法的稳定路径
|
|
96
|
+
- `anti_pattern`:错误接口、错误 key、错误 point/category 写法
|
|
97
|
+
- 如果停在“提交成功但回读失败”“页面回显失败”等半完成状态,结束前写 `session_state`。
|
|
98
|
+
|
|
99
|
+
## 工作流
|
|
100
|
+
|
|
101
|
+
### 1. 识别模式
|
|
102
|
+
- 编辑已有角色:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
PYTHON_BIN=./venv/bin/python
|
|
106
|
+
[[ -x "$PYTHON_BIN" ]] || PYTHON_BIN=./.venv/bin/python
|
|
107
|
+
[[ -x "$PYTHON_BIN" ]] || PYTHON_BIN=python3
|
|
108
|
+
|
|
109
|
+
"$PYTHON_BIN" .codex/skills/bpmax-role-editor/scripts/export_role.py \
|
|
110
|
+
--role-id 895023449 \
|
|
111
|
+
--workspace store_mgr \
|
|
112
|
+
--cookie-header "$BPMAX_COOKIE_HEADER"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- 新建角色 skeleton:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
"$PYTHON_BIN" .codex/skills/bpmax-role-editor/scripts/export_role.py \
|
|
119
|
+
--create-skeleton \
|
|
120
|
+
--workspace store_mgr \
|
|
121
|
+
--name "新角色" \
|
|
122
|
+
--key new_role \
|
|
123
|
+
--intro "角色说明" \
|
|
124
|
+
--cookie-header "$BPMAX_COOKIE_HEADER"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 2. 本地 work 文件
|
|
128
|
+
- `work/<stem>.json` 是唯一允许人工编辑的文件,结构固定为:
|
|
129
|
+
- `id`
|
|
130
|
+
- `mode`
|
|
131
|
+
- `workspace`
|
|
132
|
+
- `basic`
|
|
133
|
+
- `visibleScope`
|
|
134
|
+
- `permissions`
|
|
135
|
+
- `customPoints`
|
|
136
|
+
- `members`
|
|
137
|
+
- `preserve`
|
|
138
|
+
|
|
139
|
+
### 3. 第一次确认
|
|
140
|
+
- 修改 `work/<stem>.json` 后先确认差异,再记录确认状态:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
"$PYTHON_BIN" .codex/skills/bpmax-role-editor/scripts/confirm_role.py \
|
|
144
|
+
--stem 895023449 \
|
|
145
|
+
--stage work \
|
|
146
|
+
--actor codex
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 4. 构建 submit
|
|
150
|
+
- 没有第一次确认,不得构建 `submit`:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
"$PYTHON_BIN" .codex/skills/bpmax-role-editor/scripts/build_submit_payload.py \
|
|
154
|
+
--stem 895023449
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 5. lint
|
|
158
|
+
- `submit` 构建完成后必须先 lint:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
"$PYTHON_BIN" .codex/skills/bpmax-role-editor/scripts/lint_role_semantics.py \
|
|
162
|
+
--stem 895023449
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- lint 至少检查:
|
|
166
|
+
- `basic.name/key/intro` 非空
|
|
167
|
+
- `basic.key` 是稳定 key
|
|
168
|
+
- `visibleScope.mode=custom` 时必须选用户/团队/角色
|
|
169
|
+
- `permissions` 四段结构正确
|
|
170
|
+
- `customPoints.deletes` 不能删还在权限引用里的 point
|
|
171
|
+
- `members.addUserIds/removeUserRoleIds` 不得重复或冲突
|
|
172
|
+
- `workspace` 权限 key 合法
|
|
173
|
+
- `flow` 权限 key 满足运行时规则
|
|
174
|
+
|
|
175
|
+
### 6. 第二次确认
|
|
176
|
+
- lint 通过后再确认 submit:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
"$PYTHON_BIN" .codex/skills/bpmax-role-editor/scripts/confirm_role.py \
|
|
180
|
+
--stem 895023449 \
|
|
181
|
+
--stage submit \
|
|
182
|
+
--actor codex
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 7. 提交与回读
|
|
186
|
+
- 默认使用 typed CLI submit:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
bpmax-cli config role submit \
|
|
190
|
+
--id 895023449 \
|
|
191
|
+
--payload .codex/tmp/role-editor/submit/role-895023449.json \
|
|
192
|
+
--confirm "submit role 895023449"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
- 旧 `submit_role.py` 只保留为结构参考,默认会硬失败;不得用它直调 `/api/role`。
|
|
196
|
+
|
|
197
|
+
- 提交顺序固定:
|
|
198
|
+
1. `customPoints` 删除/新增/编辑
|
|
199
|
+
2. 角色 `POST/PUT /api/role`
|
|
200
|
+
3. 成员 `POST/DELETE /api/user_role`
|
|
201
|
+
|
|
202
|
+
- 回读顺序固定:
|
|
203
|
+
1. 重新读取角色列表并定位当前角色
|
|
204
|
+
2. 如涉及成员改动,回读 `user_role`
|
|
205
|
+
3. 浏览器刷新 `/w:<workspace>/role`,检查五个页签
|
|
206
|
+
|
|
207
|
+
## 运行时事实
|
|
208
|
+
- 角色页由这些组件组成:
|
|
209
|
+
- `RoleList`
|
|
210
|
+
- `BasicInfo`
|
|
211
|
+
- `SystemConfig`
|
|
212
|
+
- `CustomConfig`
|
|
213
|
+
- `FlowConfig`
|
|
214
|
+
- `Member`
|
|
215
|
+
- `SelectWorkSpace`
|
|
216
|
+
- 运行时接口:
|
|
217
|
+
- `GET /api/role`
|
|
218
|
+
- `POST /api/role`
|
|
219
|
+
- `PUT /api/role/:id`
|
|
220
|
+
- `GET /api/point/point_list`
|
|
221
|
+
- `POST /api/point`
|
|
222
|
+
- `PUT /api/point/:id`
|
|
223
|
+
- `DELETE /api/point/:id`
|
|
224
|
+
- `GET /api/workspace?page_size=10000`
|
|
225
|
+
- `POST /api/flow/list/lightweight`
|
|
226
|
+
- `GET /api/user_role`
|
|
227
|
+
- `POST /api/user_role`
|
|
228
|
+
- `DELETE /api/user_role/:id`
|
|
229
|
+
|
|
230
|
+
## 参考资料
|
|
231
|
+
- [runtime-page-shape.md](references/runtime-page-shape.md)
|
|
232
|
+
- [api-workflow.md](references/api-workflow.md)
|
|
233
|
+
- [work-file-mapping.md](references/work-file-mapping.md)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
## bpmax-cli 统一执行入口
|
|
237
|
+
|
|
238
|
+
本 npm 分发版必须优先使用 typed CLI 命令,不要让 Agent 直接拼 raw API 或直接运行旧来源脚本提交配置:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
bpmax-cli config role export --id <id> --out .codex/tmp/role-editor
|
|
242
|
+
bpmax-cli config role lint --work .codex/tmp/role-editor/work/<file>.json
|
|
243
|
+
bpmax-cli config role build --work .codex/tmp/role-editor/work/<file>.json --meta .codex/tmp/role-editor/meta/<file>.meta.json --out .codex/tmp/role-editor/submit/<file>.json
|
|
244
|
+
bpmax-cli config role submit --id <id> --payload .codex/tmp/role-editor/submit/<file>.json
|
|
245
|
+
bpmax-cli config role submit --id <id> --payload .codex/tmp/role-editor/submit/<file>.json --confirm "submit role <id>"
|
|
246
|
+
bpmax-cli config role verify --id <id> --expect .codex/tmp/role-editor/work/<file>.json
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
授权前置:当前 profile 必须通过校对码授权,并在授权页开启“配置能力”。如果 CLI 返回 capability 缺失,停止并让用户使用有管理权限的账号重新授权。
|
|
250
|
+
|
|
251
|
+
旧来源中的 `scripts/` 和 `references/` 只作为字段结构、lint 规则和验收规则参考;真实远端写操作必须走 `bpmax-cli config role submit`,保留 dry-run、二次确认、审计和回读验证。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# API Workflow
|
|
2
|
+
|
|
3
|
+
## 导出
|
|
4
|
+
- 角色详情:当前页面运行时直接复用 `GET /api/role?page=1&page_size=20&sort=-id`
|
|
5
|
+
- point 列表:`GET /api/point/point_list`
|
|
6
|
+
- 工作区列表:`GET /api/workspace?page_size=10000`
|
|
7
|
+
- 流程选择与回读:`POST /api/flow/list/lightweight`
|
|
8
|
+
- 成员列表:`GET /api/user_role?page=1&page_size=<n>&role_id=<id>`
|
|
9
|
+
|
|
10
|
+
## 提交
|
|
11
|
+
- 角色:
|
|
12
|
+
- 创建:`POST /api/role`
|
|
13
|
+
- 编辑:`PUT /api/role/:id`
|
|
14
|
+
- 自定义权限点:
|
|
15
|
+
- 新建:`POST /api/point`
|
|
16
|
+
- 编辑:`PUT /api/point/:id`
|
|
17
|
+
- 删除:`DELETE /api/point/:id`
|
|
18
|
+
- 成员:
|
|
19
|
+
- 新增:`POST /api/user_role`
|
|
20
|
+
- 删除:`DELETE /api/user_role/:id`
|
|
21
|
+
|
|
22
|
+
## 提交顺序
|
|
23
|
+
1. 先处理 point delta
|
|
24
|
+
2. 再提交 role 本体
|
|
25
|
+
3. 最后处理成员 delta
|
|
26
|
+
|
|
27
|
+
## 回读
|
|
28
|
+
1. 再读 `GET /api/role`,按 `id` 或 `key` 定位当前角色
|
|
29
|
+
2. 若涉及成员改动,再读 `GET /api/user_role`
|
|
30
|
+
3. 浏览器刷新角色页做最终验收
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Runtime Page Shape
|
|
2
|
+
|
|
3
|
+
- 角色页地址:`/w:store_mgr/role`
|
|
4
|
+
- 主界面由左侧角色列表和右侧详情区组成。
|
|
5
|
+
- 右侧页签固定包含:
|
|
6
|
+
- `基本信息`
|
|
7
|
+
- `系统配置`
|
|
8
|
+
- `自定义权限`
|
|
9
|
+
- `流程权限`
|
|
10
|
+
- `成员管理`
|
|
11
|
+
- `基本信息` 包含:
|
|
12
|
+
- `角色名`
|
|
13
|
+
- `角色Key`
|
|
14
|
+
- `角色说明`
|
|
15
|
+
- 可见范围单选:`全部 / 仅自己 / 部分可用`
|
|
16
|
+
- `系统配置` 与 `流程权限` 都允许按工作区维度配置权限。
|
|
17
|
+
- `自定义权限` 使用 point 列表;point 编辑单元最终落到 `/api/point`。
|
|
18
|
+
- `成员管理` 通过 `user_role` 建立成员与角色关系,不是把成员数组直接塞回 `role`。
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Work File Mapping
|
|
2
|
+
|
|
3
|
+
## work.basic
|
|
4
|
+
- `name -> role.name`
|
|
5
|
+
- `key -> role.key`
|
|
6
|
+
- `intro -> role.intro`
|
|
7
|
+
|
|
8
|
+
## work.visibleScope
|
|
9
|
+
- `mode=all -> visible_scope.value=team.all`
|
|
10
|
+
- `mode=self -> visible_scope.value=team.self`
|
|
11
|
+
- `mode=custom -> visible_scope.value=team.specify_team_and_user`
|
|
12
|
+
- `config.role/user/group -> visible_scope.config.role/user/group`
|
|
13
|
+
|
|
14
|
+
## work.permissions
|
|
15
|
+
- `system -> permissions.system`
|
|
16
|
+
- `custom -> permissions.custom`
|
|
17
|
+
- `flow -> permissions.flow`
|
|
18
|
+
- `workspace -> permissions.workspace`
|
|
19
|
+
|
|
20
|
+
## work.customPoints
|
|
21
|
+
- `upserts[] -> POST/PUT /api/point`
|
|
22
|
+
- `deletes[] -> DELETE /api/point/:id`
|
|
23
|
+
|
|
24
|
+
## work.members
|
|
25
|
+
- `addUserIds[] -> POST /api/user_role`
|
|
26
|
+
- `removeUserRoleIds[] -> DELETE /api/user_role/:id`
|
|
27
|
+
|
|
28
|
+
## submit
|
|
29
|
+
- `submit.role` 是角色本体提交计划
|
|
30
|
+
- `submit.pointOps` 是自定义权限点 delta
|
|
31
|
+
- `submit.memberOps` 是成员 delta
|
|
32
|
+
- `submit.verify` 只保存回读验证需要的期望值
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
from role_editor_common import (
|
|
7
|
+
build_submit_payload,
|
|
8
|
+
dump_json,
|
|
9
|
+
ensure_build_allowed,
|
|
10
|
+
load_json,
|
|
11
|
+
paths_for,
|
|
12
|
+
update_build_meta,
|
|
13
|
+
write_diff,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
18
|
+
parser = argparse.ArgumentParser(description="Build BPMAX role submit payload from work file.")
|
|
19
|
+
parser.add_argument("--stem", required=True)
|
|
20
|
+
return parser
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main() -> int:
|
|
24
|
+
args = build_parser().parse_args()
|
|
25
|
+
paths = paths_for(args.stem)
|
|
26
|
+
ensure_build_allowed(paths["meta"], paths["work"])
|
|
27
|
+
work = load_json(paths["work"])
|
|
28
|
+
submit = build_submit_payload(work)
|
|
29
|
+
dump_json(paths["submit"], submit)
|
|
30
|
+
update_build_meta(paths["meta"], stem=args.stem, work_path=paths["work"], submit_path=paths["submit"])
|
|
31
|
+
write_diff(paths["submit_diff"], work, submit, "work", "submit")
|
|
32
|
+
print(paths["submit"])
|
|
33
|
+
print(paths["submit_diff"])
|
|
34
|
+
return 0
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
from role_editor_common import paths_for, update_confirmation_state
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
10
|
+
parser = argparse.ArgumentParser(description="Persist confirmation state for BPMAX role editor artifacts.")
|
|
11
|
+
parser.add_argument("--stem", required=True)
|
|
12
|
+
parser.add_argument("--stage", required=True, choices=("work", "submit"))
|
|
13
|
+
parser.add_argument("--actor", default="codex")
|
|
14
|
+
return parser
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main() -> int:
|
|
18
|
+
args = build_parser().parse_args()
|
|
19
|
+
paths = paths_for(args.stem)
|
|
20
|
+
update_confirmation_state(
|
|
21
|
+
paths["meta"],
|
|
22
|
+
stem=args.stem,
|
|
23
|
+
actor=args.actor,
|
|
24
|
+
stage=args.stage,
|
|
25
|
+
work_path=paths["work"],
|
|
26
|
+
submit_path=paths["submit"],
|
|
27
|
+
)
|
|
28
|
+
print(paths["meta"])
|
|
29
|
+
return 0
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if __name__ == "__main__":
|
|
33
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
from role_editor_common import (
|
|
7
|
+
build_client,
|
|
8
|
+
build_create_work_payload,
|
|
9
|
+
build_flow_key,
|
|
10
|
+
detail_to_work_payload,
|
|
11
|
+
dump_json,
|
|
12
|
+
paths_for,
|
|
13
|
+
write_diff,
|
|
14
|
+
write_export_meta,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
19
|
+
parser = argparse.ArgumentParser(description="Export BPMAX role data into local temp files.")
|
|
20
|
+
parser.add_argument("--role-id", type=int)
|
|
21
|
+
parser.add_argument("--create-skeleton", action="store_true")
|
|
22
|
+
parser.add_argument("--name", default="")
|
|
23
|
+
parser.add_argument("--key", default="")
|
|
24
|
+
parser.add_argument("--intro", default="")
|
|
25
|
+
parser.add_argument("--workspace")
|
|
26
|
+
parser.add_argument("--base-url")
|
|
27
|
+
parser.add_argument("--language", default="zhCN")
|
|
28
|
+
parser.add_argument("--cookie-header")
|
|
29
|
+
parser.add_argument("--timeout", type=float, default=30)
|
|
30
|
+
parser.add_argument("--insecure", action="store_true")
|
|
31
|
+
return parser
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _collect_flow_details(client, permissions: dict) -> list[dict]:
|
|
35
|
+
flow_keys = []
|
|
36
|
+
for key in permissions.get("flow", {}).keys():
|
|
37
|
+
if key.startswith("default:"):
|
|
38
|
+
flow_keys.append(key.split(":", 1)[1])
|
|
39
|
+
elif key.endswith(":"):
|
|
40
|
+
flow_keys.append(key[:-1])
|
|
41
|
+
for workspace_permissions in permissions.get("workspace", {}).values():
|
|
42
|
+
for key in workspace_permissions.get("flow", {}).keys():
|
|
43
|
+
if key.startswith("default:"):
|
|
44
|
+
flow_keys.append(key.split(":", 1)[1])
|
|
45
|
+
elif key.endswith(":"):
|
|
46
|
+
flow_keys.append(key[:-1])
|
|
47
|
+
flow_keys = sorted({key for key in flow_keys if key})
|
|
48
|
+
flows = client.get_flows_by_keys(flow_keys)
|
|
49
|
+
seen = set()
|
|
50
|
+
normalized = []
|
|
51
|
+
for item in flows:
|
|
52
|
+
permission_key = build_flow_key(item)
|
|
53
|
+
if permission_key in seen:
|
|
54
|
+
continue
|
|
55
|
+
seen.add(permission_key)
|
|
56
|
+
normalized.append(item)
|
|
57
|
+
return normalized
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def main() -> int:
|
|
61
|
+
args = build_parser().parse_args()
|
|
62
|
+
if not args.create_skeleton and not args.role_id:
|
|
63
|
+
raise SystemExit("export requires --role-id unless using --create-skeleton")
|
|
64
|
+
client = build_client(args)
|
|
65
|
+
if args.create_skeleton:
|
|
66
|
+
point_details = client.get_point_list()
|
|
67
|
+
role_list = client.get_role_list(page_size=1000)
|
|
68
|
+
workspace_list = client.get_workspace_list()
|
|
69
|
+
stem = f"create-{client.workspace}-{args.key or 'role'}"
|
|
70
|
+
paths = paths_for(stem)
|
|
71
|
+
raw_detail = {
|
|
72
|
+
"id": None,
|
|
73
|
+
"name": args.name,
|
|
74
|
+
"key": args.key,
|
|
75
|
+
"intro": args.intro,
|
|
76
|
+
"visible_scope": {"value": "team.self", "config": {"role": [], "user": [], "group": []}},
|
|
77
|
+
"permissions": {"system": [], "custom": [], "flow": {}, "workspace": {}},
|
|
78
|
+
"guid": None,
|
|
79
|
+
"user_count": 0,
|
|
80
|
+
"preserve": {
|
|
81
|
+
"availablePoints": point_details,
|
|
82
|
+
"availableRoles": role_list,
|
|
83
|
+
"availableWorkspaces": workspace_list,
|
|
84
|
+
"flows": [],
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
work = build_create_work_payload(
|
|
88
|
+
workspace=client.workspace,
|
|
89
|
+
name=args.name,
|
|
90
|
+
key=args.key,
|
|
91
|
+
intro=args.intro,
|
|
92
|
+
point_details=point_details,
|
|
93
|
+
role_list=role_list,
|
|
94
|
+
workspace_list=workspace_list,
|
|
95
|
+
flow_details=[],
|
|
96
|
+
)
|
|
97
|
+
request_url = client._build_url("/role?page=1&page_size=1000&sort=-id")
|
|
98
|
+
dump_json(paths["raw"], raw_detail)
|
|
99
|
+
dump_json(paths["work"], work)
|
|
100
|
+
write_export_meta(
|
|
101
|
+
paths["meta"],
|
|
102
|
+
stem=stem,
|
|
103
|
+
mode="create",
|
|
104
|
+
workspace=client.workspace,
|
|
105
|
+
role_id=None,
|
|
106
|
+
request_url=request_url,
|
|
107
|
+
raw_path=paths["raw"],
|
|
108
|
+
work_path=paths["work"],
|
|
109
|
+
)
|
|
110
|
+
write_diff(paths["work_diff"], raw_detail, work, "raw", "work")
|
|
111
|
+
else:
|
|
112
|
+
role_detail = client.get_role(args.role_id)
|
|
113
|
+
permissions = role_detail.get("permissions") if isinstance(role_detail.get("permissions"), dict) else {}
|
|
114
|
+
point_details = client.get_point_list()
|
|
115
|
+
member_details = client.get_member_list(args.role_id)
|
|
116
|
+
role_list = client.get_role_list(page_size=1000)
|
|
117
|
+
workspace_list = client.get_workspace_list()
|
|
118
|
+
flow_details = _collect_flow_details(client, permissions)
|
|
119
|
+
stem = str(args.role_id)
|
|
120
|
+
paths = paths_for(stem)
|
|
121
|
+
raw_detail = {
|
|
122
|
+
**role_detail,
|
|
123
|
+
"preserve": {
|
|
124
|
+
"availablePoints": point_details,
|
|
125
|
+
"existingMembers": member_details,
|
|
126
|
+
"availableRoles": role_list,
|
|
127
|
+
"availableWorkspaces": workspace_list,
|
|
128
|
+
"flows": flow_details,
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
work = detail_to_work_payload(
|
|
132
|
+
role_detail,
|
|
133
|
+
workspace=client.workspace,
|
|
134
|
+
point_details=point_details,
|
|
135
|
+
member_details=member_details,
|
|
136
|
+
role_list=role_list,
|
|
137
|
+
workspace_list=workspace_list,
|
|
138
|
+
flow_details=flow_details,
|
|
139
|
+
mode="edit",
|
|
140
|
+
)
|
|
141
|
+
request_url = client._build_url(f"/role?page=1&page_size=1000&sort=-id")
|
|
142
|
+
dump_json(paths["raw"], raw_detail)
|
|
143
|
+
dump_json(paths["work"], work)
|
|
144
|
+
write_export_meta(
|
|
145
|
+
paths["meta"],
|
|
146
|
+
stem=stem,
|
|
147
|
+
mode="edit",
|
|
148
|
+
workspace=client.workspace,
|
|
149
|
+
role_id=args.role_id,
|
|
150
|
+
request_url=request_url,
|
|
151
|
+
raw_path=paths["raw"],
|
|
152
|
+
work_path=paths["work"],
|
|
153
|
+
)
|
|
154
|
+
write_diff(paths["work_diff"], raw_detail, work, "raw", "work")
|
|
155
|
+
print(paths["raw"])
|
|
156
|
+
print(paths["work"])
|
|
157
|
+
print(paths["meta"])
|
|
158
|
+
print(paths["work_diff"])
|
|
159
|
+
return 0
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
if __name__ == "__main__":
|
|
163
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
from role_editor_common import dump_json, ensure_lint_allowed, lint_work_payload, load_json, paths_for, update_lint_meta
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
10
|
+
parser = argparse.ArgumentParser(description="Lint BPMAX role editor work and submit payloads.")
|
|
11
|
+
parser.add_argument("--stem", required=True)
|
|
12
|
+
return parser
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main() -> int:
|
|
16
|
+
args = build_parser().parse_args()
|
|
17
|
+
paths = paths_for(args.stem)
|
|
18
|
+
ensure_lint_allowed(paths["meta"], paths["work"], paths["submit"])
|
|
19
|
+
work = load_json(paths["work"])
|
|
20
|
+
raw = load_json(paths["raw"])
|
|
21
|
+
lint = lint_work_payload(work, raw_payload=raw)
|
|
22
|
+
dump_json(paths["lint"], lint)
|
|
23
|
+
update_lint_meta(
|
|
24
|
+
paths["meta"],
|
|
25
|
+
stem=args.stem,
|
|
26
|
+
work_path=paths["work"],
|
|
27
|
+
submit_path=paths["submit"],
|
|
28
|
+
lint_path=paths["lint"],
|
|
29
|
+
lint_report=lint,
|
|
30
|
+
)
|
|
31
|
+
print(paths["lint"])
|
|
32
|
+
if not lint.get("ok"):
|
|
33
|
+
raise SystemExit("lint failed; inspect lint.json for details")
|
|
34
|
+
return 0
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
raise SystemExit(main())
|