bpmax-cli 0.1.44-beta.8 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/bin.js +466 -4578
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-skills.mjs +0 -98
- package/skills/bpmax-auth/SKILL.md +17 -6
- package/skills/bpmax-cli/SKILL.md +0 -2
- package/skills/bpmax-project/SKILL.md +2 -1
- package/skills/bpmax-shared/SKILL.md +1 -1
- package/skills/bpmax-api-platform-editor/SKILL.md +0 -321
- package/skills/bpmax-api-platform-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-api-platform-editor/references/api-doc-debug-workflow.md +0 -34
- package/skills/bpmax-api-platform-editor/references/api-proxy-shape.md +0 -41
- package/skills/bpmax-api-platform-editor/references/instance-config-shape.md +0 -41
- package/skills/bpmax-api-platform-editor/references/platform-api-map.md +0 -52
- package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +0 -32
- package/skills/bpmax-api-platform-editor/scripts/api_platform_editor_common.py +0 -1276
- package/skills/bpmax-api-platform-editor/scripts/build_submit_payload.py +0 -64
- package/skills/bpmax-api-platform-editor/scripts/capture_write_contract.py +0 -40
- package/skills/bpmax-api-platform-editor/scripts/export_layer_bundle.py +0 -212
- package/skills/bpmax-api-platform-editor/scripts/record_doc_debug_acceptance.py +0 -62
- package/skills/bpmax-api-platform-editor/scripts/submit_and_verify_layer.py +0 -75
- package/skills/bpmax-api-platform-editor/tests/test_api_platform_editor.py +0 -287
- package/skills/bpmax-builder-shared/SKILL.md +0 -44
- package/skills/bpmax-builder-shared/base_url.py +0 -81
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.json +0 -71
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.md +0 -34
- package/skills/bpmax-builder-shared/runtime-script-template-catalog.md +0 -123
- package/skills/bpmax-builder-shared/runtime_script_rules.py +0 -272
- package/skills/bpmax-builder-shared/skill_audit.py +0 -374
- package/skills/bpmax-builder-shared/template_script_hard_rules.py +0 -280
- package/skills/bpmax-builder-shared/tests/test_base_url.py +0 -80
- package/skills/bpmax-builder-shared/tests/test_runtime_script_rules.py +0 -115
- package/skills/bpmax-builder-shared/tests/test_skill_audit.py +0 -231
- package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +0 -281
- package/skills/bpmax-config-latest/SKILL.md +0 -71
- package/skills/bpmax-console-template-editor/SKILL.md +0 -536
- package/skills/bpmax-console-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-console-template-editor/references/filter-integration.md +0 -60
- package/skills/bpmax-console-template-editor/references/lessons-from-resume-dashboard.md +0 -114
- package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +0 -69
- package/skills/bpmax-console-template-editor/references/module-catalog.md +0 -100
- package/skills/bpmax-console-template-editor/references/runtime-page-shape.md +0 -91
- package/skills/bpmax-console-template-editor/references/template-shape.md +0 -149
- package/skills/bpmax-console-template-editor/scripts/build_submit_payload.py +0 -38
- package/skills/bpmax-console-template-editor/scripts/confirm_console_template.py +0 -33
- package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +0 -964
- package/skills/bpmax-console-template-editor/scripts/export_console_template.py +0 -99
- package/skills/bpmax-console-template-editor/scripts/lint_console_template.py +0 -46
- package/skills/bpmax-console-template-editor/scripts/submit_console_template.py +0 -99
- package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +0 -383
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +0 -600
- package/skills/bpmax-dataset-field-template-editor/references/create-request-gotchas.md +0 -25
- package/skills/bpmax-dataset-field-template-editor/references/field-classify-mapping.md +0 -35
- package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +0 -24
- package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +0 -61
- package/skills/bpmax-dataset-field-template-editor/references/virtual-field-patterns.md +0 -27
- package/skills/bpmax-dataset-field-template-editor/references/work-file-to-submit-mapping.md +0 -127
- package/skills/bpmax-dataset-field-template-editor/scripts/build_submit_payload.py +0 -67
- package/skills/bpmax-dataset-field-template-editor/scripts/confirm_dataset_field.py +0 -37
- package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +0 -784
- package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +0 -62
- package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +0 -104
- package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +0 -83
- package/skills/bpmax-dataset-field-template-editor/scripts/lint_dataset_field_semantics.py +0 -35
- package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +0 -95
- package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +0 -709
- package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +0 -59
- package/skills/bpmax-dataset-template-editor/SKILL.md +0 -779
- package/skills/bpmax-dataset-template-editor/references/custom-key-usage-patterns.md +0 -18
- package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +0 -73
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-authoring-guide.md +0 -186
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-example-catalog.md +0 -106
- package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +0 -28
- package/skills/bpmax-dataset-template-editor/references/runtime-verified-dataset-page-shape.md +0 -47
- package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +0 -23
- package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +0 -97
- package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +0 -65
- package/skills/bpmax-dataset-template-editor/scripts/build_submit_payload.py +0 -38
- package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +0 -650
- package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +0 -155
- package/skills/bpmax-dataset-template-editor/scripts/lint_dataset_template.py +0 -42
- package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +0 -43
- package/skills/bpmax-dataset-template-editor/scripts/scan_custom_key_references.py +0 -27
- package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +0 -115
- package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +0 -52
- package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +0 -39
- package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +0 -373
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +0 -177
- package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +0 -4
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +0 -60
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +0 -394
- package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +0 -5
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json +0 -97
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_final_v2.json +0 -105
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_main.json +0 -36
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_region.json +0 -40
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +0 -41
- package/skills/bpmax-e2e-flow-test-operator/references/failure-update-loop.md +0 -17
- package/skills/bpmax-e2e-flow-test-operator/references/filter-field-discovery.md +0 -40
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +0 -24
- package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +0 -75
- package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +0 -107
- package/skills/bpmax-e2e-flow-test-operator/references/skill-experience-coverage-matrix.md +0 -29
- package/skills/bpmax-e2e-flow-test-operator/references/stale-runtime-and-clean-sample-rules.md +0 -54
- package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +0 -83
- package/skills/bpmax-e2e-flow-test-operator/scripts/bpmax_session.py +0 -287
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_plan.json +0 -59
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_runner.py +0 -687
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +0 -121
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +0 -288
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_api_matrix.py +0 -161
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_filter_fields.py +0 -138
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_form_runtime.py +0 -396
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +0 -341
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_test_profile.py +0 -185
- package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +0 -138
- package/skills/bpmax-feishu-chat-flow-plugin-editor/SKILL.md +0 -69
- package/skills/bpmax-feishu-chat-flow-plugin-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-checklist.md +0 -42
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-recipes.md +0 -38
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-shape.md +0 -86
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/gate-lint.md +0 -68
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/hoocoo-patterns.md +0 -39
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/runtime-behavior.md +0 -41
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/script-authoring.md +0 -110
- package/skills/bpmax-feishu-chat-flow-plugin-editor/scripts/lint_feishu_chat_plugin.py +0 -278
- package/skills/bpmax-feishu-chat-flow-plugin-editor/tests/test_lint_feishu_chat_plugin.py +0 -203
- package/skills/bpmax-filter-template-editor/SKILL.md +0 -564
- package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +0 -38
- package/skills/bpmax-filter-template-editor/references/filter-and-flow-binding.md +0 -57
- package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +0 -141
- package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +0 -287
- package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +0 -115
- package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +0 -94
- package/skills/bpmax-filter-template-editor/scripts/build_submit_payload.py +0 -25
- package/skills/bpmax-filter-template-editor/scripts/confirm_filter_template.py +0 -22
- package/skills/bpmax-filter-template-editor/scripts/export_filter_template.py +0 -57
- package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +0 -348
- package/skills/bpmax-filter-template-editor/scripts/init_create_filter_template.py +0 -8
- package/skills/bpmax-filter-template-editor/scripts/lint_filter_template_semantics.py +0 -26
- package/skills/bpmax-filter-template-editor/scripts/submit_filter_template.py +0 -62
- package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +0 -231
- package/skills/bpmax-flow-template-editor/SKILL.md +0 -1058
- package/skills/bpmax-flow-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-flow-template-editor/references/before-next-step-script-runtime-gotchas.md +0 -62
- package/skills/bpmax-flow-template-editor/references/config-surfaces-and-placeholders.md +0 -270
- package/skills/bpmax-flow-template-editor/references/diff-strategy.md +0 -67
- package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +0 -25
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +0 -174
- package/skills/bpmax-flow-template-editor/references/intent-model.md +0 -117
- package/skills/bpmax-flow-template-editor/references/lessons-from-price-plan-flow.md +0 -147
- package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +0 -97
- package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +0 -165
- package/skills/bpmax-flow-template-editor/references/payload-checklist.md +0 -133
- package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +0 -54
- package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +0 -149
- package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +0 -41
- package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +0 -155
- package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +0 -179
- package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +0 -91
- package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +0 -93
- package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +0 -57
- package/skills/bpmax-flow-template-editor/scripts/build_submit_payload.py +0 -69
- package/skills/bpmax-flow-template-editor/scripts/confirm_flow_template.py +0 -52
- package/skills/bpmax-flow-template-editor/scripts/export_flow_template.py +0 -114
- package/skills/bpmax-flow-template-editor/scripts/flow_template_editor_common.py +0 -1084
- package/skills/bpmax-flow-template-editor/scripts/submit_flow_template.py +0 -159
- package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +0 -636
- package/skills/bpmax-form-template-editor/SKILL.md +0 -1099
- package/skills/bpmax-form-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +0 -203
- package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +0 -125
- package/skills/bpmax-form-template-editor/references/payload-checklist.md +0 -77
- package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +0 -49
- package/skills/bpmax-form-template-editor/scripts/build_submit_payload.py +0 -37
- package/skills/bpmax-form-template-editor/scripts/check_form_template_consistency.py +0 -145
- package/skills/bpmax-form-template-editor/scripts/confirm_form_template.py +0 -67
- package/skills/bpmax-form-template-editor/scripts/export_form_template.py +0 -91
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +0 -1762
- package/skills/bpmax-form-template-editor/scripts/lint_form_template_semantics.py +0 -30
- package/skills/bpmax-form-template-editor/scripts/record_runtime_acceptance.py +0 -67
- package/skills/bpmax-form-template-editor/scripts/submit_form_template.py +0 -163
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +0 -1292
- package/skills/bpmax-list-template-editor/SKILL.md +0 -468
- package/skills/bpmax-list-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-list-template-editor/references/browser-page-contract.md +0 -81
- package/skills/bpmax-list-template-editor/references/content-config-shape.md +0 -148
- package/skills/bpmax-list-template-editor/references/dataset-field-mapping.md +0 -60
- package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +0 -103
- package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +0 -102
- package/skills/bpmax-list-template-editor/references/payload-checklist.md +0 -47
- package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +0 -140
- package/skills/bpmax-list-template-editor/references/special-formats.md +0 -394
- package/skills/bpmax-list-template-editor/scripts/build_submit_payload.py +0 -37
- package/skills/bpmax-list-template-editor/scripts/confirm_list_template.py +0 -33
- package/skills/bpmax-list-template-editor/scripts/export_list_template.py +0 -89
- package/skills/bpmax-list-template-editor/scripts/fetch_data_set.py +0 -34
- package/skills/bpmax-list-template-editor/scripts/lint_list_template_semantics.py +0 -54
- package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +0 -955
- package/skills/bpmax-list-template-editor/scripts/record_acceptance.py +0 -55
- package/skills/bpmax-list-template-editor/scripts/submit_list_template.py +0 -117
- package/skills/bpmax-list-template-editor/tests/test_list_template_editor_common.py +0 -441
- package/skills/bpmax-memory-protocol/SKILL.md +0 -72
- package/skills/bpmax-nav-config-editor/SKILL.md +0 -347
- package/skills/bpmax-nav-config-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +0 -68
- package/skills/bpmax-nav-config-editor/references/config-shape.md +0 -78
- package/skills/bpmax-nav-config-editor/references/icon-selection.md +0 -83
- package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +0 -46
- package/skills/bpmax-nav-config-editor/references/payload-checklist.md +0 -41
- package/skills/bpmax-nav-config-editor/references/runtime-probing.md +0 -47
- package/skills/bpmax-nav-config-editor/scripts/build_submit_payload.py +0 -34
- package/skills/bpmax-nav-config-editor/scripts/confirm_nav_config.py +0 -32
- package/skills/bpmax-nav-config-editor/scripts/export_nav_config.py +0 -56
- package/skills/bpmax-nav-config-editor/scripts/lint_nav_config_semantics.py +0 -33
- package/skills/bpmax-nav-config-editor/scripts/nav_config_editor_common.py +0 -812
- package/skills/bpmax-nav-config-editor/scripts/submit_nav_config.py +0 -44
- package/skills/bpmax-nav-config-editor/scripts/verify_nav_config.py +0 -33
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor.py +0 -358
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor_common.py +0 -138
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_lint.py +0 -58
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_submit_verify.py +0 -51
- package/skills/bpmax-project-detail-template-editor/SKILL.md +0 -329
- package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +0 -4
- package/skills/bpmax-project-detail-template-editor/references/local-temp-workflow.md +0 -59
- package/skills/bpmax-project-detail-template-editor/references/module-catalog-and-config-notes.md +0 -47
- package/skills/bpmax-project-detail-template-editor/references/payload-checklist.md +0 -33
- package/skills/bpmax-project-detail-template-editor/references/project-detail-template-api-workflow.md +0 -44
- package/skills/bpmax-project-detail-template-editor/scripts/build_submit_payload.py +0 -30
- package/skills/bpmax-project-detail-template-editor/scripts/confirm_project_detail_template.py +0 -33
- package/skills/bpmax-project-detail-template-editor/scripts/export_project_detail_template.py +0 -87
- package/skills/bpmax-project-detail-template-editor/scripts/lint_project_detail_template_semantics.py +0 -37
- package/skills/bpmax-project-detail-template-editor/scripts/project_detail_template_editor_common.py +0 -507
- package/skills/bpmax-project-detail-template-editor/scripts/submit_project_detail_template.py +0 -120
- package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py +0 -369
- package/skills/bpmax-role-editor/SKILL.md +0 -251
- package/skills/bpmax-role-editor/references/api-workflow.md +0 -30
- package/skills/bpmax-role-editor/references/runtime-page-shape.md +0 -18
- package/skills/bpmax-role-editor/references/work-file-mapping.md +0 -32
- package/skills/bpmax-role-editor/scripts/build_submit_payload.py +0 -38
- package/skills/bpmax-role-editor/scripts/confirm_role.py +0 -33
- package/skills/bpmax-role-editor/scripts/export_role.py +0 -163
- package/skills/bpmax-role-editor/scripts/lint_role_semantics.py +0 -38
- package/skills/bpmax-role-editor/scripts/role_editor_common.py +0 -1231
- package/skills/bpmax-role-editor/scripts/submit_role.py +0 -144
- package/skills/bpmax-role-editor/tests/test_role_editor.py +0 -343
- package/skills/bpmax-user-mock-operator/SKILL.md +0 -106
- package/skills/bpmax-user-mock-operator/agents/openai.yaml +0 -4
- package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +0 -37
- package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +0 -136
- package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +0 -138
- package/skills/form-control-library/SKILL.md +0 -82
- package/skills/form-control-library/agents/openai.yaml +0 -4
- package/skills/form-control-library/references/form-controls.md +0 -199
- package/skills/form-control-library/references/form-template-submit-schema.md +0 -180
- package/skills/form-control-library/references/group-select-runtime.md +0 -191
- package/skills/form-control-library/scripts/rebuild_form_control_library.py +0 -55
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
import tempfile
|
|
5
|
-
import unittest
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
SCRIPT_DIR = Path(__file__).resolve().parents[1]
|
|
10
|
-
if str(SCRIPT_DIR) not in sys.path:
|
|
11
|
-
sys.path.insert(0, str(SCRIPT_DIR))
|
|
12
|
-
|
|
13
|
-
from skill_audit import audit_skill_root # noqa: E402
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
REPO_ROOT = Path(__file__).resolve().parents[4]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class SkillAuditTests(unittest.TestCase):
|
|
20
|
-
def test_flags_hardcoded_bpmax_origin(self) -> None:
|
|
21
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
22
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
23
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
24
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
25
|
-
(skill_root / "SKILL.md").write_text(
|
|
26
|
-
"Use `https://prod.bpmax.local` when calling the API.\n",
|
|
27
|
-
encoding="utf-8",
|
|
28
|
-
)
|
|
29
|
-
report = audit_skill_root(skill_root)
|
|
30
|
-
self.assertFalse(report["ok"])
|
|
31
|
-
self.assertEqual(report["findings"][0]["code"], "hardcoded_domain")
|
|
32
|
-
|
|
33
|
-
def test_flags_hardcoded_real_test_origin(self) -> None:
|
|
34
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
35
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
36
|
-
skill_root.mkdir(parents=True)
|
|
37
|
-
(skill_root / "SKILL.md").write_text(
|
|
38
|
-
"Use `https://demo-" + "test.example.com` when calling the API.\n",
|
|
39
|
-
encoding="utf-8",
|
|
40
|
-
)
|
|
41
|
-
report = audit_skill_root(skill_root)
|
|
42
|
-
self.assertFalse(report["ok"])
|
|
43
|
-
self.assertEqual(report["findings"][0]["code"], "hardcoded_domain")
|
|
44
|
-
|
|
45
|
-
def test_flags_doc_claiming_scripts_unimplemented(self) -> None:
|
|
46
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
47
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
48
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
49
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
50
|
-
(skill_root / "SKILL.md").write_text("当前仓库里这些脚本还不存在。\n", encoding="utf-8")
|
|
51
|
-
report = audit_skill_root(skill_root)
|
|
52
|
-
self.assertFalse(report["ok"])
|
|
53
|
-
self.assertEqual(report["findings"][0]["code"], "doc_claims_scripts_unimplemented")
|
|
54
|
-
|
|
55
|
-
def test_flags_missing_script_reference(self) -> None:
|
|
56
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
57
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
58
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
59
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
60
|
-
(skill_root / "SKILL.md").write_text("调用 `verify_runtime.py` 完成最终校验。\n", encoding="utf-8")
|
|
61
|
-
report = audit_skill_root(skill_root)
|
|
62
|
-
self.assertFalse(report["ok"])
|
|
63
|
-
self.assertEqual(report["findings"][0]["code"], "doc_references_missing_script")
|
|
64
|
-
|
|
65
|
-
def test_flags_missing_runtime_script_governance_reference(self) -> None:
|
|
66
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
67
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
68
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
69
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
70
|
-
(skill_root / "SKILL.md").write_text(
|
|
71
|
-
"\n".join(
|
|
72
|
-
[
|
|
73
|
-
"# Demo",
|
|
74
|
-
"- 修改 `lambda` 与 `customeValidate.content` 时,先抽取再回写。",
|
|
75
|
-
"- 这里没有引用统一的脚本位点矩阵。",
|
|
76
|
-
]
|
|
77
|
-
)
|
|
78
|
-
+ "\n",
|
|
79
|
-
encoding="utf-8",
|
|
80
|
-
)
|
|
81
|
-
report = audit_skill_root(skill_root)
|
|
82
|
-
self.assertFalse(report["ok"])
|
|
83
|
-
self.assertTrue(
|
|
84
|
-
any(finding["code"] == "missing_runtime_script_governance_reference" for finding in report["findings"])
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
def test_flags_forbidden_then_in_runtime_docs(self) -> None:
|
|
88
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
89
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
90
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
91
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
92
|
-
(skill_root / "SKILL.md").write_text(
|
|
93
|
-
"\n".join(
|
|
94
|
-
[
|
|
95
|
-
"# Demo",
|
|
96
|
-
"- 统一参考 `../bpmax-builder-shared/runtime-script-site-matrix.md`。",
|
|
97
|
-
"```js",
|
|
98
|
-
"return ctx.$query('select 1').then((rows) => rows);",
|
|
99
|
-
"```",
|
|
100
|
-
]
|
|
101
|
-
)
|
|
102
|
-
+ "\n",
|
|
103
|
-
encoding="utf-8",
|
|
104
|
-
)
|
|
105
|
-
report = audit_skill_root(skill_root)
|
|
106
|
-
self.assertFalse(report["ok"])
|
|
107
|
-
self.assertTrue(any(finding["code"] == "forbidden_promise_then" for finding in report["findings"]))
|
|
108
|
-
|
|
109
|
-
def test_flags_project_list_guidance(self) -> None:
|
|
110
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
111
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
112
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
113
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
114
|
-
(skill_root / "SKILL.md").write_text(
|
|
115
|
-
"\n".join(
|
|
116
|
-
[
|
|
117
|
-
"# Demo",
|
|
118
|
-
"- 统一参考 `../bpmax-builder-shared/runtime-script-site-matrix.md`。",
|
|
119
|
-
"- 普通字段联动默认用 `ctx.$axios.post('/bpmax/project/list')`。",
|
|
120
|
-
]
|
|
121
|
-
)
|
|
122
|
-
+ "\n",
|
|
123
|
-
encoding="utf-8",
|
|
124
|
-
)
|
|
125
|
-
report = audit_skill_root(skill_root)
|
|
126
|
-
self.assertFalse(report["ok"])
|
|
127
|
-
self.assertTrue(any(finding["code"] == "project_list_guidance_forbidden" for finding in report["findings"]))
|
|
128
|
-
|
|
129
|
-
def test_flags_project_list_code_fence(self) -> None:
|
|
130
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
131
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
132
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
133
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
134
|
-
(skill_root / "SKILL.md").write_text(
|
|
135
|
-
"\n".join(
|
|
136
|
-
[
|
|
137
|
-
"# Demo",
|
|
138
|
-
"- 统一参考 `../bpmax-builder-shared/runtime-script-site-matrix.md`。",
|
|
139
|
-
"```js",
|
|
140
|
-
"return ctx.$axios.post('/bpmax/project/list?page=1', { flow_type: 'flow1', query: {} });",
|
|
141
|
-
"```",
|
|
142
|
-
]
|
|
143
|
-
)
|
|
144
|
-
+ "\n",
|
|
145
|
-
encoding="utf-8",
|
|
146
|
-
)
|
|
147
|
-
report = audit_skill_root(skill_root)
|
|
148
|
-
self.assertFalse(report["ok"])
|
|
149
|
-
self.assertTrue(any(finding["code"] == "project_list_code_fence_forbidden" for finding in report["findings"]))
|
|
150
|
-
|
|
151
|
-
def test_allows_verification_reference_to_project_list(self) -> None:
|
|
152
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
153
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
154
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
155
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
156
|
-
(skill_root / "SKILL.md").write_text(
|
|
157
|
-
"\n".join(
|
|
158
|
-
[
|
|
159
|
-
"# Demo",
|
|
160
|
-
"- 统一参考 `../bpmax-builder-shared/runtime-script-site-matrix.md`。",
|
|
161
|
-
"- 回读 `POST /bpmax/project/list` 的真实请求体,仅用于验收验证。",
|
|
162
|
-
]
|
|
163
|
-
)
|
|
164
|
-
+ "\n",
|
|
165
|
-
encoding="utf-8",
|
|
166
|
-
)
|
|
167
|
-
report = audit_skill_root(skill_root)
|
|
168
|
-
self.assertTrue(report["ok"], report["errors"])
|
|
169
|
-
|
|
170
|
-
def test_all_runtime_code_fences_are_linted_not_just_shared_catalog(self) -> None:
|
|
171
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
172
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
173
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
174
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
175
|
-
long_script = "\n".join(f"const line{idx} = {idx};" for idx in range(45))
|
|
176
|
-
(skill_root / "SKILL.md").write_text(
|
|
177
|
-
"\n".join(
|
|
178
|
-
[
|
|
179
|
-
"# Demo",
|
|
180
|
-
"- 统一参考 `../bpmax-builder-shared/runtime-script-site-matrix.md`。",
|
|
181
|
-
"## lambda",
|
|
182
|
-
"```js",
|
|
183
|
-
long_script,
|
|
184
|
-
"```",
|
|
185
|
-
]
|
|
186
|
-
)
|
|
187
|
-
+ "\n",
|
|
188
|
-
encoding="utf-8",
|
|
189
|
-
)
|
|
190
|
-
report = audit_skill_root(skill_root)
|
|
191
|
-
self.assertFalse(report["ok"])
|
|
192
|
-
self.assertTrue(any(finding["code"] == "line_budget_exceeded" for finding in report["findings"]))
|
|
193
|
-
|
|
194
|
-
def test_antipattern_prose_with_then_is_not_flagged(self) -> None:
|
|
195
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
196
|
-
skill_root = Path(tmpdir) / "demo-skill"
|
|
197
|
-
(skill_root / "scripts").mkdir(parents=True)
|
|
198
|
-
(skill_root / "scripts" / "submit_demo.py").write_text("print('ok')\n", encoding="utf-8")
|
|
199
|
-
(skill_root / "SKILL.md").write_text(
|
|
200
|
-
"\n".join(
|
|
201
|
-
[
|
|
202
|
-
"# Demo",
|
|
203
|
-
"- 统一参考 `../bpmax-builder-shared/runtime-script-site-matrix.md`。",
|
|
204
|
-
"- 反模式:不要再写 `ctx.$axios(...).then(...)` 这种链式回调。",
|
|
205
|
-
]
|
|
206
|
-
)
|
|
207
|
-
+ "\n",
|
|
208
|
-
encoding="utf-8",
|
|
209
|
-
)
|
|
210
|
-
report = audit_skill_root(skill_root)
|
|
211
|
-
self.assertTrue(report["ok"], report["errors"])
|
|
212
|
-
|
|
213
|
-
def test_form_flow_and_dataset_skills_pass_audit(self) -> None:
|
|
214
|
-
skill_roots = [
|
|
215
|
-
REPO_ROOT / ".codex" / "skills" / "bpmax-form-template-editor",
|
|
216
|
-
REPO_ROOT / ".codex" / "skills" / "bpmax-flow-template-editor",
|
|
217
|
-
REPO_ROOT / ".codex" / "skills" / "bpmax-dataset-template-editor",
|
|
218
|
-
]
|
|
219
|
-
for root in skill_roots:
|
|
220
|
-
with self.subTest(skill=root.name):
|
|
221
|
-
self.assertTrue(audit_skill_root(root)["ok"])
|
|
222
|
-
|
|
223
|
-
def test_filter_and_role_skills_pass_audit(self) -> None:
|
|
224
|
-
filter_root = REPO_ROOT / ".codex" / "skills" / "bpmax-filter-template-editor"
|
|
225
|
-
role_root = REPO_ROOT / ".codex" / "skills" / "bpmax-role-editor"
|
|
226
|
-
self.assertTrue(audit_skill_root(filter_root)["ok"])
|
|
227
|
-
self.assertTrue(audit_skill_root(role_root)["ok"])
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if __name__ == "__main__":
|
|
231
|
-
unittest.main()
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
import unittest
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR = Path(__file__).resolve().parents[1]
|
|
9
|
-
if str(SCRIPT_DIR) not in sys.path:
|
|
10
|
-
sys.path.insert(0, str(SCRIPT_DIR))
|
|
11
|
-
|
|
12
|
-
from template_script_hard_rules import scan_named_script_surfaces # noqa: E402
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class TemplateScriptHardRulesTests(unittest.TestCase):
|
|
16
|
-
def test_blocks_bpmax_project_list_with_data_set_id(self) -> None:
|
|
17
|
-
report = scan_named_script_surfaces(
|
|
18
|
-
[
|
|
19
|
-
{
|
|
20
|
-
"path": "fields.sn.lambda",
|
|
21
|
-
"script": "return ctx.$axios.post('/bpmax/project/list?page=1', { data_set_id: 716, query: {} });",
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
self.assertFalse(report["ok"])
|
|
27
|
-
self.assertTrue(any(item["path"] == "fields.sn.lambda" for item in report["findings"]))
|
|
28
|
-
|
|
29
|
-
def test_blocks_bpmax_project_list_without_data_set_id(self) -> None:
|
|
30
|
-
report = scan_named_script_surfaces(
|
|
31
|
-
[
|
|
32
|
-
{
|
|
33
|
-
"path": "fields.sn.lambda",
|
|
34
|
-
"script": "return ctx.$axios.post('/bpmax/project/list?page=1', { flow_type: 'flow716', query: {} });",
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
self.assertFalse(report["ok"])
|
|
40
|
-
self.assertTrue(any(item["rule"] == "project_list_forbidden" for item in report["findings"]))
|
|
41
|
-
|
|
42
|
-
def test_blocks_ctx_es_query_with_data_set_id(self) -> None:
|
|
43
|
-
report = scan_named_script_surfaces(
|
|
44
|
-
[
|
|
45
|
-
{
|
|
46
|
-
"path": "fields.selector.props.template.search",
|
|
47
|
-
"script": "return ctx.$esQuery({ data_set_id: 620, query: { status: { type: 'term', value: 1 } } })",
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
self.assertFalse(report["ok"])
|
|
53
|
-
self.assertEqual(report["findings"][0]["rule"], "es_query_data_set_id")
|
|
54
|
-
|
|
55
|
-
def test_blocks_structured_query_payload_with_data_set_id(self) -> None:
|
|
56
|
-
report = scan_named_script_surfaces(
|
|
57
|
-
[
|
|
58
|
-
{
|
|
59
|
-
"path": "content.beforeSearch",
|
|
60
|
-
"value": {
|
|
61
|
-
"$template": "{ ctx.value = { data_set_id: 620, query: {} }; }",
|
|
62
|
-
},
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
self.assertFalse(report["ok"])
|
|
68
|
-
self.assertEqual(report["findings"][0]["rule"], "structured_query_data_set_id")
|
|
69
|
-
|
|
70
|
-
def test_blocks_raw_es_search_with_data_set_id(self) -> None:
|
|
71
|
-
report = scan_named_script_surfaces(
|
|
72
|
-
[
|
|
73
|
-
{
|
|
74
|
-
"path": "fields.selector.lambda",
|
|
75
|
-
"script": (
|
|
76
|
-
"return ctx.$axios.post('/bpmax/project/raw-es-search', "
|
|
77
|
-
"{ flow_type: 'flow620', data_set_id: 620, body: { query: {} } });"
|
|
78
|
-
),
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
self.assertFalse(report["ok"])
|
|
84
|
-
self.assertTrue(any(item["rule"] == "raw_es_search_data_set_id" for item in report["findings"]))
|
|
85
|
-
|
|
86
|
-
def test_blocks_es_project_list_helper(self) -> None:
|
|
87
|
-
report = scan_named_script_surfaces(
|
|
88
|
-
[
|
|
89
|
-
{
|
|
90
|
-
"path": "fields.selector.lambda",
|
|
91
|
-
"script": "return dataService.ESProjectList({ flow_type: 'flow716', query: {} });",
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
self.assertFalse(report["ok"])
|
|
97
|
-
self.assertTrue(any(item["rule"] == "project_list_forbidden" for item in report["findings"]))
|
|
98
|
-
|
|
99
|
-
def test_allows_annotated_user_scope_project_list(self) -> None:
|
|
100
|
-
report = scan_named_script_surfaces(
|
|
101
|
-
[
|
|
102
|
-
{
|
|
103
|
-
"path": "fields.selector.lambda",
|
|
104
|
-
"script": (
|
|
105
|
-
"// bpmax-allow-user-scope-project-list: user visible project chooser\n"
|
|
106
|
-
"return ctx.$axios.post('/bpmax/project/list?page=1', { flow_type: 'flow716', query: {} });"
|
|
107
|
-
),
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
self.assertTrue(report["ok"])
|
|
113
|
-
self.assertEqual(report["findings"], [])
|
|
114
|
-
|
|
115
|
-
def test_blocks_root_user_es_project_list_helper(self) -> None:
|
|
116
|
-
report = scan_named_script_surfaces(
|
|
117
|
-
[
|
|
118
|
-
{
|
|
119
|
-
"path": "scripts.pre_process_script",
|
|
120
|
-
"script": "return rootUser.esProjectList({ flow_type: 'flow716', query: {} });",
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
self.assertFalse(report["ok"])
|
|
126
|
-
self.assertTrue(any(item["rule"] == "project_list_forbidden" for item in report["findings"]))
|
|
127
|
-
|
|
128
|
-
def test_allows_raw_es_search_with_data_set_key(self) -> None:
|
|
129
|
-
report = scan_named_script_surfaces(
|
|
130
|
-
[
|
|
131
|
-
{
|
|
132
|
-
"path": "fields.sn.lambda",
|
|
133
|
-
"script": (
|
|
134
|
-
"return ctx.$axios.post('/bpmax/project/raw-es-search', "
|
|
135
|
-
"{ flow_type: 'flow716', data_set_key: 'inventory', body: { query: { bool: { must: [] } }, sort: [], from: 0, size: 10 } });"
|
|
136
|
-
),
|
|
137
|
-
}
|
|
138
|
-
]
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
self.assertTrue(report["ok"])
|
|
142
|
-
self.assertEqual(report["findings"], [])
|
|
143
|
-
|
|
144
|
-
def test_ignores_top_level_binding_fields(self) -> None:
|
|
145
|
-
report = scan_named_script_surfaces(
|
|
146
|
-
[
|
|
147
|
-
{
|
|
148
|
-
"path": "basic.data_set_id",
|
|
149
|
-
"value": 620,
|
|
150
|
-
}
|
|
151
|
-
]
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
self.assertTrue(report["ok"])
|
|
155
|
-
self.assertEqual(report["findings"], [])
|
|
156
|
-
|
|
157
|
-
def test_blocks_sql_join_lookup(self) -> None:
|
|
158
|
-
report = scan_named_script_surfaces(
|
|
159
|
-
[
|
|
160
|
-
{
|
|
161
|
-
"path": "scripts.pre_process_script",
|
|
162
|
-
"script": "const rows = await ctx.$query('select a.id from a join b on a.id = b.a_id');",
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
self.assertFalse(report["ok"])
|
|
168
|
-
self.assertTrue(any(item["rule"] == "sql_join_forbidden" for item in report["findings"]))
|
|
169
|
-
|
|
170
|
-
def test_blocks_large_es_pull_then_script_matching(self) -> None:
|
|
171
|
-
report = scan_named_script_surfaces(
|
|
172
|
-
[
|
|
173
|
-
{
|
|
174
|
-
"path": "fields.selector.lambda",
|
|
175
|
-
"script": (
|
|
176
|
-
"const rows = await ctx.$esQuery({ data_set_key: 'inventory', body: { size: 1000, query: {} } });"
|
|
177
|
-
"return rows.find((row) => row.sn === ctx.value);"
|
|
178
|
-
),
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
self.assertFalse(report["ok"])
|
|
184
|
-
self.assertTrue(any(item["rule"] == "bulk_es_script_matching" for item in report["findings"]))
|
|
185
|
-
|
|
186
|
-
def test_blocks_frontend_detail_counting(self) -> None:
|
|
187
|
-
report = scan_named_script_surfaces(
|
|
188
|
-
[
|
|
189
|
-
{
|
|
190
|
-
"path": "console.modules[0].dataSource",
|
|
191
|
-
"script": (
|
|
192
|
-
"const rows = await ctx.$esQuery({ data_set_key: 'dealer_inv_opt', body: { size: 1000, query: {} } });"
|
|
193
|
-
"let inventoryQty = 0; rows.forEach(() => inventoryQty += 1);"
|
|
194
|
-
),
|
|
195
|
-
}
|
|
196
|
-
]
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
self.assertFalse(report["ok"])
|
|
200
|
-
self.assertTrue(any(item["rule"] == "frontend_detail_counting" for item in report["findings"]))
|
|
201
|
-
|
|
202
|
-
def test_blocks_wildcard_star_as_non_empty_check(self) -> None:
|
|
203
|
-
report = scan_named_script_surfaces(
|
|
204
|
-
[
|
|
205
|
-
{
|
|
206
|
-
"path": "filter.content.beforeSearch",
|
|
207
|
-
"script": "ctx.query = { wildcard: { dealerName: { value: '*' } } };",
|
|
208
|
-
}
|
|
209
|
-
]
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
self.assertFalse(report["ok"])
|
|
213
|
-
self.assertTrue(any(item["rule"] == "wildcard_star_non_empty" for item in report["findings"]))
|
|
214
|
-
|
|
215
|
-
def test_blocks_dealer_inventory_detail_query_without_aggregation(self) -> None:
|
|
216
|
-
report = scan_named_script_surfaces(
|
|
217
|
-
[
|
|
218
|
-
{
|
|
219
|
-
"path": "console.modules[0].dataSource",
|
|
220
|
-
"script": "return ctx.$esQuery({ flow_type: 'flow956693507', data_set_key: 'dealer_inv_opt', body: { size: 100, query: {} } });",
|
|
221
|
-
}
|
|
222
|
-
]
|
|
223
|
-
)
|
|
224
|
-
|
|
225
|
-
self.assertFalse(report["ok"])
|
|
226
|
-
self.assertTrue(any(item["rule"] == "dealer_inv_opt_without_aggregation" for item in report["findings"]))
|
|
227
|
-
|
|
228
|
-
def test_blocks_project_list_count_total_as_accurate_total(self) -> None:
|
|
229
|
-
report = scan_named_script_surfaces(
|
|
230
|
-
[
|
|
231
|
-
{
|
|
232
|
-
"path": "console.modules[0].dataSource",
|
|
233
|
-
"script": (
|
|
234
|
-
"const response = await ctx.$axios.post('/bpmax/project/list?page=1', { flow_type: 'flow716' });"
|
|
235
|
-
"return response.data.count || response.data.total;"
|
|
236
|
-
),
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
self.assertFalse(report["ok"])
|
|
242
|
-
self.assertTrue(any(item["rule"] == "project_list_count_total_capped" for item in report["findings"]))
|
|
243
|
-
|
|
244
|
-
def test_blocks_query_inside_loop(self) -> None:
|
|
245
|
-
report = scan_named_script_surfaces(
|
|
246
|
-
[
|
|
247
|
-
{
|
|
248
|
-
"path": "console.modules[0].dataSource",
|
|
249
|
-
"script": (
|
|
250
|
-
"for (const sn of sns) {"
|
|
251
|
-
" await ctx.$esQuery({ data_set_key: 'inventory', body: { query: { term: { sn } }, size: 1 } });"
|
|
252
|
-
"}"
|
|
253
|
-
),
|
|
254
|
-
}
|
|
255
|
-
]
|
|
256
|
-
)
|
|
257
|
-
|
|
258
|
-
self.assertFalse(report["ok"])
|
|
259
|
-
self.assertTrue(any(item["rule"] == "query_inside_loop" for item in report["findings"]))
|
|
260
|
-
|
|
261
|
-
def test_blocks_serial_org_lookup_inside_loop(self) -> None:
|
|
262
|
-
report = scan_named_script_surfaces(
|
|
263
|
-
[
|
|
264
|
-
{
|
|
265
|
-
"path": "console.modules[0].dataSource",
|
|
266
|
-
"script": (
|
|
267
|
-
"rows.map(async (row) => {"
|
|
268
|
-
" const group = await ctx.$axios.get('/api/group/' + row.groupId);"
|
|
269
|
-
" return group.data;"
|
|
270
|
-
"});"
|
|
271
|
-
),
|
|
272
|
-
}
|
|
273
|
-
]
|
|
274
|
-
)
|
|
275
|
-
|
|
276
|
-
self.assertFalse(report["ok"])
|
|
277
|
-
self.assertTrue(any(item["rule"] == "serial_org_lookup_inside_loop" for item in report["findings"]))
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if __name__ == "__main__":
|
|
281
|
-
unittest.main()
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: bpmax-config-latest
|
|
3
|
-
description: Use when refreshing, updating, or synchronizing a BPMAX sysconfig workspace for any configured environment before or after configuration work.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# BPMAX Config Latest Refresh
|
|
7
|
-
|
|
8
|
-
用于刷新当前配置环境的 sysconfig 镜像,让本地配置仓库与平台配置库保持一致。这个 skill 不绑定任何具体环境;环境名必须来自用户、当前 `AGENTS.md` 的 BPMAX 配置区块,或 profile 中已有的 `config_environments`。
|
|
9
|
-
|
|
10
|
-
## 触发场景
|
|
11
|
-
|
|
12
|
-
- 用户要求“刷新配置”“同步最新配置”“拉最新配置库”“更新 sysconfig”。
|
|
13
|
-
- 配置编辑前需要确保本地配置镜像是线上最新状态。
|
|
14
|
-
- 配置提交或端到端验收结束后,需要再次刷新配置库并确认最新状态。
|
|
15
|
-
- 完整配置编排开始前或结束后需要执行统一 latest 同步。
|
|
16
|
-
|
|
17
|
-
## 前置检查
|
|
18
|
-
|
|
19
|
-
1. 确认目标环境 `<env>`,不要猜测或硬编码环境名,也不要使用环境专属 latest skill。
|
|
20
|
-
2. 确认 profile 和 config-dir。若 `AGENTS.md` 中给出了 `--config-dir` 前缀,后续命令必须保留该前缀。
|
|
21
|
-
3. 确认当前 profile 已授权,并且平台返回 `config.repository.view` 与 `config.latest.pull` capability。
|
|
22
|
-
4. 确认本地配置 workspace 已初始化;如果 CLI 提示缺少 repo path,先执行:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
bpmax-cli config workspace init <env> --profile <profile> --workspace-dir <dir> --format json
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
`config workspace init` 会从 BPMAX 平台配置库读取 Git 地址和 sysconfigdiff 地址,clone 或绑定本地 sysconfig 仓库,并更新 `AGENTS.md`。不要让用户手写配置库密码。
|
|
29
|
-
|
|
30
|
-
## 标准命令
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
bpmax-cli config latest pull <env> --profile <profile> --format json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
如果是在 Agent 专用 config-dir 中工作,必须保留 init/setup 返回的 `--config-dir` 前缀:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
bpmax-cli --config-dir <config_dir> config latest pull <env> --profile <profile> --format json
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## 标准流程
|
|
43
|
-
|
|
44
|
-
1. 运行 `capabilities status` 或使用 CLI 自动 capability 检查确认 `config.latest.pull` 可用。
|
|
45
|
-
2. 如果 workspace 未初始化,先执行 `bpmax-cli config workspace init <env> ...`。
|
|
46
|
-
3. 执行 `bpmax-cli config latest pull <env> --profile <profile> --format json`。
|
|
47
|
-
4. 读取 JSON 输出中的步骤状态、before/after、diff summary 和错误信息。
|
|
48
|
-
5. 如果刷新是配置编辑前置动作,继续进入对应 `bpmax-*-template-editor` skill;如果刷新是收尾动作,向用户说明配置库同步结果和剩余风险。
|
|
49
|
-
|
|
50
|
-
## 执行规则
|
|
51
|
-
|
|
52
|
-
- latest pull 必须由 CLI 读取平台配置库中的 Git 地址、账号、密码和 PULL/EXTRACT/PUSH URL。
|
|
53
|
-
- 不要让用户手写或在对话中暴露配置库密码、API Key、Authorization、token、验证码、手机号等敏感信息。
|
|
54
|
-
- 不要直接运行旧的配置库脚本、curl、raw API 或页面 fetch 来替代 `bpmax-cli config latest pull`。
|
|
55
|
-
- 如果本地 sysconfig 仓库有未提交变更,先向用户说明变更风险;只有用户确认或任务计划明确允许时,才追加 `--allow-dirty` 重试。
|
|
56
|
-
- 若 CLI 提示缺少 capability、配置库接口不可用、workspace 未初始化或 Git remote 不匹配,停止并报告具体阻断点。
|
|
57
|
-
- latest 刷新只更新配置镜像,不等于提交配置变更;不要把刷新成功说成配置发布成功。
|
|
58
|
-
|
|
59
|
-
## 成功后检查
|
|
60
|
-
|
|
61
|
-
- 读取 CLI JSON 输出中的状态、执行步骤和 before/after 信息。
|
|
62
|
-
- 如输出包含 diff summary,基于 diff 说明配置变化的业务含义。
|
|
63
|
-
- 确认输出和审计中没有明文 password、token、API Key、Authorization、验证码或手机号。
|
|
64
|
-
|
|
65
|
-
## 常见阻断
|
|
66
|
-
|
|
67
|
-
- `missing config.latest.pull capability`:当前账号或 API Key 未开启配置能力,重新授权并在授权页勾选配置能力。
|
|
68
|
-
- `config repository environment not found`:平台配置库没有该环境,先在平台配置库页面补齐环境。
|
|
69
|
-
- `sysconfig repo path is missing`:先执行 `config workspace init <env>` 绑定本地 workspace。
|
|
70
|
-
- `dirty worktree`:先向用户说明本地未提交变更;确认后才允许 `--allow-dirty`。
|
|
71
|
-
- `remote mismatch`:本地目录不是当前环境的配置库;除非用户明确确认,否则不要使用 `--force` 重新绑定。
|