bpmax-cli 0.1.44 → 0.2.1-beta.2
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 +52 -5
- package/dist/bin.js +12304 -1315
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-skills.mjs +98 -0
- package/skills/bpmax-ai-taskbook/SKILL.md +227 -0
- package/skills/bpmax-ai-taskbook/agents/openai.yaml +3 -0
- package/skills/bpmax-ai-taskbook/references/taskbook-template.md +68 -0
- 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-approval-matrix/SKILL.md +90 -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 +5 -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 +606 -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 +217 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +4 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +63 -0
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +551 -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/ai-test-suite.md +333 -0
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +41 -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 +24 -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 +109 -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 +83 -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 +121 -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 +1095 -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 +174 -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 +168 -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 +106 -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 +96 -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 +1113 -0
- package/skills/bpmax-form-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +203 -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 +91 -0
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +1762 -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 +1292 -0
- package/skills/bpmax-list-template-editor/SKILL.md +478 -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 +165 -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 +108 -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 +147 -0
- package/skills/bpmax-list-template-editor/references/special-formats.md +411 -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-memory-protocol/SKILL.md +72 -0
- package/skills/bpmax-nav-config-editor/SKILL.md +350 -0
- package/skills/bpmax-nav-config-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +70 -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 +51 -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-plugin-config/SKILL.md +42 -0
- package/skills/bpmax-project/SKILL.md +17 -3
- package/skills/bpmax-project-detail-template-editor/SKILL.md +355 -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 +120 -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/bpmax-user-mock-operator/SKILL.md +106 -0
- package/skills/bpmax-user-mock-operator/agents/openai.yaml +4 -0
- package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +37 -0
- package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +136 -0
- package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +138 -0
- package/skills/bpmax-workspace-editor/SKILL.md +78 -0
- package/skills/bpmax-workspace-editor/agents/openai.yaml +4 -0
- 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
package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
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
|
+
import project_detail_template_editor_common as common # noqa: E402
|
|
15
|
+
import submit_project_detail_template as submit_script # noqa: E402
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ProjectDetailTemplateEditorTests(unittest.TestCase):
|
|
19
|
+
def _write_ready_submit_fixture(self, root: Path, *, stem: str, mode: str, template_id: int | None = None) -> dict[str, Path]:
|
|
20
|
+
paths = {
|
|
21
|
+
"meta": root / "meta.json",
|
|
22
|
+
"work": root / "work.json",
|
|
23
|
+
"submit": root / "submit.json",
|
|
24
|
+
}
|
|
25
|
+
work_payload = {
|
|
26
|
+
"id": template_id if mode == "edit" else None,
|
|
27
|
+
"mode": mode,
|
|
28
|
+
"basic": {
|
|
29
|
+
"name": "详情模板",
|
|
30
|
+
"desc": "",
|
|
31
|
+
"type": 2,
|
|
32
|
+
"flow_type": "flow801021391",
|
|
33
|
+
"flow_key": "",
|
|
34
|
+
"status": 1,
|
|
35
|
+
},
|
|
36
|
+
"content": {"config": {}, "main_col": [], "side_col": []},
|
|
37
|
+
"meta": {},
|
|
38
|
+
}
|
|
39
|
+
common.dump_json(paths["work"], work_payload)
|
|
40
|
+
common.dump_json(
|
|
41
|
+
paths["meta"],
|
|
42
|
+
common.ensure_meta_shape(
|
|
43
|
+
{"stem": stem, "mode": mode, "workspace": "store_mgr", "templateId": template_id},
|
|
44
|
+
stem,
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
common.dump_json(paths["submit"], common.build_submit_payload(work_payload))
|
|
48
|
+
common.update_confirmation_state(
|
|
49
|
+
paths["meta"], stem=stem, actor="codex", stage="submit", work_path=paths["work"], submit_path=paths["submit"]
|
|
50
|
+
)
|
|
51
|
+
lint_path = root / "lint.json"
|
|
52
|
+
common.dump_json(lint_path, {"ok": True})
|
|
53
|
+
common.update_lint_meta(paths["meta"], stem=stem, submit_path=paths["submit"], lint_path=lint_path, report={"ok": True})
|
|
54
|
+
meta_payload = common.load_json(paths["meta"])
|
|
55
|
+
meta_payload["status"] = "submit_confirmed"
|
|
56
|
+
common.dump_json(paths["meta"], meta_payload)
|
|
57
|
+
return paths
|
|
58
|
+
|
|
59
|
+
def test_edit_round_trip_builds_submit(self) -> None:
|
|
60
|
+
detail = {
|
|
61
|
+
"id": 954573597,
|
|
62
|
+
"name": "入库信息",
|
|
63
|
+
"desc": "用于项目详情页面展示加盟商信息",
|
|
64
|
+
"type": 2,
|
|
65
|
+
"status": 1,
|
|
66
|
+
"flow_type": "flow801021391",
|
|
67
|
+
"flow_key": "",
|
|
68
|
+
"content": "{\"config\":{\"enable_share\":true},\"main_col\":[{\"type\":\"meta-form\",\"title\":\"待入库信息\",\"config\":{}}],\"side_col\":[{\"type\":\"step-log\",\"title\":\"流程日志\",\"config\":{}}]}",
|
|
69
|
+
"uuid": "1008e2bf-6675-459b-ac79-f7768b224b76",
|
|
70
|
+
}
|
|
71
|
+
work = common.detail_to_work_payload(detail, mode="edit")
|
|
72
|
+
submit = common.build_submit_payload(work)
|
|
73
|
+
self.assertEqual(submit["type"], 2)
|
|
74
|
+
self.assertEqual(common.parse_content(submit["content"])["main_col"][0]["type"], "meta-form")
|
|
75
|
+
|
|
76
|
+
def test_create_skeleton_stem_and_payload(self) -> None:
|
|
77
|
+
detail = {
|
|
78
|
+
"id": 954573597,
|
|
79
|
+
"name": "入库信息",
|
|
80
|
+
"desc": "",
|
|
81
|
+
"flow_type": "flow801021391",
|
|
82
|
+
"flow_key": "",
|
|
83
|
+
"type": 2,
|
|
84
|
+
"status": 1,
|
|
85
|
+
"content": "{\"config\":{},\"main_col\":[],\"side_col\":[]}",
|
|
86
|
+
}
|
|
87
|
+
stem = common.create_stem("flow801021391", "", 954573597)
|
|
88
|
+
raw = common.build_create_raw_payload(detail, sample_template_id=954573597)
|
|
89
|
+
self.assertEqual(stem, "create-flow801021391-default-954573597")
|
|
90
|
+
self.assertEqual(raw["sampleTemplateId"], 954573597)
|
|
91
|
+
self.assertEqual(raw["type"], 2)
|
|
92
|
+
|
|
93
|
+
def test_lint_blocks_side_only_module_in_main_col(self) -> None:
|
|
94
|
+
work = {
|
|
95
|
+
"mode": "edit",
|
|
96
|
+
"basic": {
|
|
97
|
+
"name": "详情模板",
|
|
98
|
+
"desc": "",
|
|
99
|
+
"type": 2,
|
|
100
|
+
"flow_type": "flow801021391",
|
|
101
|
+
"flow_key": "",
|
|
102
|
+
"status": 1,
|
|
103
|
+
},
|
|
104
|
+
"content": {
|
|
105
|
+
"config": {},
|
|
106
|
+
"main_col": [{"type": "step-log", "title": "流程日志", "config": {}}],
|
|
107
|
+
"side_col": [],
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
report = common.lint_project_detail_template_semantics(work)
|
|
111
|
+
self.assertFalse(report["ok"])
|
|
112
|
+
self.assertTrue(any("not allowed in main_col" in item for item in report["errors"]))
|
|
113
|
+
|
|
114
|
+
def test_lint_blocks_missing_main_or_side_shape(self) -> None:
|
|
115
|
+
work = {
|
|
116
|
+
"mode": "edit",
|
|
117
|
+
"basic": {
|
|
118
|
+
"name": "详情模板",
|
|
119
|
+
"desc": "",
|
|
120
|
+
"type": 2,
|
|
121
|
+
"flow_type": "flow801021391",
|
|
122
|
+
"flow_key": "",
|
|
123
|
+
"status": 1,
|
|
124
|
+
},
|
|
125
|
+
"content": {"config": [], "main_col": {}, "side_col": []},
|
|
126
|
+
}
|
|
127
|
+
with self.assertRaises(SystemExit):
|
|
128
|
+
common.build_submit_payload(work)
|
|
129
|
+
|
|
130
|
+
def test_unknown_module_is_advanced_mode_warning_not_blocker(self) -> None:
|
|
131
|
+
work = {
|
|
132
|
+
"mode": "edit",
|
|
133
|
+
"basic": {
|
|
134
|
+
"name": "详情模板",
|
|
135
|
+
"desc": "",
|
|
136
|
+
"type": 2,
|
|
137
|
+
"flow_type": "flow801021391",
|
|
138
|
+
"flow_key": "",
|
|
139
|
+
"status": 1,
|
|
140
|
+
},
|
|
141
|
+
"content": {
|
|
142
|
+
"config": {},
|
|
143
|
+
"main_col": [{"type": "not-exist-yet", "title": "实验模块", "config": {}}],
|
|
144
|
+
"side_col": [],
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
report = common.lint_project_detail_template_semantics(work)
|
|
148
|
+
self.assertTrue(report["ok"])
|
|
149
|
+
self.assertTrue(any("advanced JSON mode candidate only" in item for item in report["warnings"]))
|
|
150
|
+
|
|
151
|
+
def test_lint_blocks_project_list_query(self) -> None:
|
|
152
|
+
work = {
|
|
153
|
+
"mode": "edit",
|
|
154
|
+
"basic": {
|
|
155
|
+
"name": "详情模板",
|
|
156
|
+
"desc": "",
|
|
157
|
+
"type": 2,
|
|
158
|
+
"flow_type": "flow801021391",
|
|
159
|
+
"flow_key": "",
|
|
160
|
+
"status": 1,
|
|
161
|
+
},
|
|
162
|
+
"content": {
|
|
163
|
+
"config": {
|
|
164
|
+
"$template": (
|
|
165
|
+
"{ return ctx.$axios.post('/bpmax/project/list?page=1', "
|
|
166
|
+
"{ flow_type: 'flow801021391', query: {} }); }"
|
|
167
|
+
)
|
|
168
|
+
},
|
|
169
|
+
"main_col": [],
|
|
170
|
+
"side_col": [],
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
report = common.lint_project_detail_template_semantics(work)
|
|
174
|
+
self.assertFalse(report["ok"])
|
|
175
|
+
self.assertTrue(any("project/list" in item for item in report["errors"]))
|
|
176
|
+
|
|
177
|
+
def test_submit_gate_requires_lint(self) -> None:
|
|
178
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
179
|
+
meta = Path(tmpdir) / "meta.json"
|
|
180
|
+
work = Path(tmpdir) / "work.json"
|
|
181
|
+
submit = Path(tmpdir) / "submit.json"
|
|
182
|
+
common.dump_json(
|
|
183
|
+
work,
|
|
184
|
+
{
|
|
185
|
+
"mode": "edit",
|
|
186
|
+
"basic": {
|
|
187
|
+
"name": "详情模板",
|
|
188
|
+
"desc": "",
|
|
189
|
+
"type": 2,
|
|
190
|
+
"flow_type": "flow801021391",
|
|
191
|
+
"flow_key": "",
|
|
192
|
+
"status": 1,
|
|
193
|
+
},
|
|
194
|
+
"content": {"config": {}, "main_col": [], "side_col": []},
|
|
195
|
+
},
|
|
196
|
+
)
|
|
197
|
+
common.dump_json(meta, common.ensure_meta_shape({"stem": "x", "mode": "edit", "workspace": "store_mgr"}, "x"))
|
|
198
|
+
common.update_confirmation_state(meta, stem="x", actor="codex", stage="work", work_path=work, submit_path=submit)
|
|
199
|
+
common.dump_json(submit, common.build_submit_payload(common.load_json(work)))
|
|
200
|
+
common.update_build_meta(meta, stem="x", work_path=work, submit_path=submit)
|
|
201
|
+
common.update_confirmation_state(meta, stem="x", actor="codex", stage="submit", work_path=work, submit_path=submit)
|
|
202
|
+
with self.assertRaises(SystemExit):
|
|
203
|
+
common.ensure_submission_allowed(meta, work, submit)
|
|
204
|
+
|
|
205
|
+
def test_persist_create_submission_meta_sets_edit_mode_and_ids(self) -> None:
|
|
206
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
207
|
+
meta_path = Path(tmpdir) / "meta.json"
|
|
208
|
+
common.dump_json(
|
|
209
|
+
meta_path,
|
|
210
|
+
common.ensure_meta_shape(
|
|
211
|
+
{"stem": "x", "mode": "create", "workspace": "store_mgr", "status": "submit_confirmed"},
|
|
212
|
+
"x",
|
|
213
|
+
),
|
|
214
|
+
)
|
|
215
|
+
payload = common.persist_create_submission_meta(
|
|
216
|
+
meta_path,
|
|
217
|
+
stem="x",
|
|
218
|
+
action_mode="create",
|
|
219
|
+
template_id=123,
|
|
220
|
+
readback={"id": 123, "uuid": "uuid-123"},
|
|
221
|
+
)
|
|
222
|
+
self.assertEqual(payload["mode"], "edit")
|
|
223
|
+
self.assertEqual(payload["templateId"], 123)
|
|
224
|
+
self.assertEqual(payload["templateUuid"], "uuid-123")
|
|
225
|
+
self.assertEqual(payload["status"], "submit_confirmed")
|
|
226
|
+
|
|
227
|
+
def test_submit_create_persists_meta_and_verify_mode(self) -> None:
|
|
228
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
229
|
+
tmp_root = Path(tmpdir)
|
|
230
|
+
stem = "create-stem"
|
|
231
|
+
paths = self._write_ready_submit_fixture(tmp_root, stem=stem, mode="create")
|
|
232
|
+
script_paths = {
|
|
233
|
+
"meta": paths["meta"],
|
|
234
|
+
"work": paths["work"],
|
|
235
|
+
"submit": paths["submit"],
|
|
236
|
+
"response": tmp_root / "response.json",
|
|
237
|
+
"readback": tmp_root / "readback.json",
|
|
238
|
+
"verify": tmp_root / "verify.json",
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
class FakeClient:
|
|
242
|
+
def __init__(self) -> None:
|
|
243
|
+
self.created_payloads: list[dict] = []
|
|
244
|
+
self.updated_payloads: list[tuple[int, dict]] = []
|
|
245
|
+
|
|
246
|
+
def create_flow_page_template(self, payload: dict) -> dict:
|
|
247
|
+
self.created_payloads.append(payload)
|
|
248
|
+
return {"data": {"id": 321}}
|
|
249
|
+
|
|
250
|
+
def update_flow_page_template(self, template_id: int, payload: dict) -> dict:
|
|
251
|
+
self.updated_payloads.append((template_id, payload))
|
|
252
|
+
return {"data": {"id": template_id}}
|
|
253
|
+
|
|
254
|
+
def get_flow_page_template(self, template_id: int) -> dict:
|
|
255
|
+
return {
|
|
256
|
+
"data": {
|
|
257
|
+
"id": template_id,
|
|
258
|
+
"uuid": "uuid-321",
|
|
259
|
+
"name": "详情模板",
|
|
260
|
+
"desc": "",
|
|
261
|
+
"type": 2,
|
|
262
|
+
"flow_type": "flow801021391",
|
|
263
|
+
"flow_key": "",
|
|
264
|
+
"content": "{\"config\":{},\"main_col\":[],\"side_col\":[]}",
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
client = FakeClient()
|
|
269
|
+
with mock.patch.object(submit_script, "build_client", return_value=client), mock.patch.object(
|
|
270
|
+
submit_script, "paths_for", return_value=script_paths
|
|
271
|
+
), mock.patch.object(sys, "argv", ["submit_project_detail_template.py", "--stem", stem, "--workspace", "store_mgr"]):
|
|
272
|
+
self.assertEqual(submit_script.main(), 0)
|
|
273
|
+
|
|
274
|
+
meta_payload = common.load_json(paths["meta"])
|
|
275
|
+
verify_payload = common.load_json(script_paths["verify"])
|
|
276
|
+
self.assertEqual(len(client.created_payloads), 1)
|
|
277
|
+
self.assertEqual(client.updated_payloads, [])
|
|
278
|
+
self.assertEqual(meta_payload["mode"], "edit")
|
|
279
|
+
self.assertEqual(meta_payload["templateId"], 321)
|
|
280
|
+
self.assertEqual(meta_payload["templateUuid"], "uuid-321")
|
|
281
|
+
self.assertEqual(meta_payload["status"], "submit_confirmed")
|
|
282
|
+
self.assertEqual(verify_payload["mode"], "create")
|
|
283
|
+
|
|
284
|
+
def test_second_submit_uses_update_when_meta_has_template_id(self) -> None:
|
|
285
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
286
|
+
tmp_root = Path(tmpdir)
|
|
287
|
+
stem = "edit-stem"
|
|
288
|
+
paths = self._write_ready_submit_fixture(tmp_root, stem=stem, mode="edit", template_id=654)
|
|
289
|
+
script_paths = {
|
|
290
|
+
"meta": paths["meta"],
|
|
291
|
+
"work": paths["work"],
|
|
292
|
+
"submit": paths["submit"],
|
|
293
|
+
"response": tmp_root / "response.json",
|
|
294
|
+
"readback": tmp_root / "readback.json",
|
|
295
|
+
"verify": tmp_root / "verify.json",
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
class FakeClient:
|
|
299
|
+
def __init__(self) -> None:
|
|
300
|
+
self.created = 0
|
|
301
|
+
self.updated_payloads: list[tuple[int, dict]] = []
|
|
302
|
+
|
|
303
|
+
def create_flow_page_template(self, payload: dict) -> dict:
|
|
304
|
+
self.created += 1
|
|
305
|
+
return {"data": {"id": 1}}
|
|
306
|
+
|
|
307
|
+
def update_flow_page_template(self, template_id: int, payload: dict) -> dict:
|
|
308
|
+
self.updated_payloads.append((template_id, payload))
|
|
309
|
+
return {"data": {"id": template_id}}
|
|
310
|
+
|
|
311
|
+
def get_flow_page_template(self, template_id: int) -> dict:
|
|
312
|
+
return {
|
|
313
|
+
"data": {
|
|
314
|
+
"id": template_id,
|
|
315
|
+
"name": "详情模板",
|
|
316
|
+
"desc": "",
|
|
317
|
+
"type": 2,
|
|
318
|
+
"flow_type": "flow801021391",
|
|
319
|
+
"flow_key": "",
|
|
320
|
+
"content": "{\"config\":{},\"main_col\":[],\"side_col\":[]}",
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
client = FakeClient()
|
|
325
|
+
with mock.patch.object(submit_script, "build_client", return_value=client), mock.patch.object(
|
|
326
|
+
submit_script, "paths_for", return_value=script_paths
|
|
327
|
+
), mock.patch.object(sys, "argv", ["submit_project_detail_template.py", "--stem", stem, "--workspace", "store_mgr"]):
|
|
328
|
+
self.assertEqual(submit_script.main(), 0)
|
|
329
|
+
|
|
330
|
+
self.assertEqual(client.created, 0)
|
|
331
|
+
self.assertEqual(len(client.updated_payloads), 1)
|
|
332
|
+
self.assertEqual(client.updated_payloads[0][0], 654)
|
|
333
|
+
self.assertEqual(common.load_json(script_paths["verify"])["mode"], "edit")
|
|
334
|
+
self.assertEqual(common.load_json(paths["meta"])["mode"], "edit")
|
|
335
|
+
|
|
336
|
+
def test_submit_create_without_id_does_not_corrupt_meta(self) -> None:
|
|
337
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
338
|
+
tmp_root = Path(tmpdir)
|
|
339
|
+
stem = "create-no-id"
|
|
340
|
+
paths = self._write_ready_submit_fixture(tmp_root, stem=stem, mode="create")
|
|
341
|
+
script_paths = {
|
|
342
|
+
"meta": paths["meta"],
|
|
343
|
+
"work": paths["work"],
|
|
344
|
+
"submit": paths["submit"],
|
|
345
|
+
"response": tmp_root / "response.json",
|
|
346
|
+
"readback": tmp_root / "readback.json",
|
|
347
|
+
"verify": tmp_root / "verify.json",
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
class FakeClient:
|
|
351
|
+
def create_flow_page_template(self, payload: dict) -> dict:
|
|
352
|
+
return {"data": {}}
|
|
353
|
+
|
|
354
|
+
before_meta = common.load_json(paths["meta"])
|
|
355
|
+
with mock.patch.object(submit_script, "build_client", return_value=FakeClient()), mock.patch.object(
|
|
356
|
+
submit_script, "paths_for", return_value=script_paths
|
|
357
|
+
), mock.patch.object(sys, "argv", ["submit_project_detail_template.py", "--stem", stem, "--workspace", "store_mgr"]):
|
|
358
|
+
with self.assertRaises(SystemExit) as ctx:
|
|
359
|
+
submit_script.main()
|
|
360
|
+
|
|
361
|
+
after_meta = common.load_json(paths["meta"])
|
|
362
|
+
self.assertIn("create response did not include a template id", str(ctx.exception))
|
|
363
|
+
self.assertEqual(before_meta["mode"], "create")
|
|
364
|
+
self.assertEqual(after_meta["mode"], "create")
|
|
365
|
+
self.assertIsNone(after_meta["templateId"])
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
if __name__ == "__main__":
|
|
369
|
+
unittest.main()
|
|
@@ -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
|
+
- 支持通过 `bpmax-cli config role delete --id <role_id>` 删除角色;必须先 dry-run,确认无成员、权限点和业务流程引用风险后,再使用精确 `--confirm` 执行并回读角色列表验收。
|
|
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
|
+
- 开始前先调用 `bpmax-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`。
|