bpmax-cli 0.1.44-beta.12 → 0.1.44-beta.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmax-cli",
3
- "version": "0.1.44-beta.12",
3
+ "version": "0.1.44-beta.14",
4
4
  "description": "CLI for BPMAX environments with multi-profile config and local login callback flow",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: "bpmax-ai-taskbook"
3
+ description: "Use when BPMAX configuration work needs an AI implementation taskbook, AI任务方案, 任务书, 任务拆解, subagent dispatch prompts, progress CSV, or object-lock review before editing flows, templates, datasets, roles, navigation, workspaces, or E2E assets."
4
+ ---
5
+
6
+ # BPMAX AI Taskbook
7
+
8
+ ## Core Rule
9
+
10
+ Use a taskbook before dispatching broad BPMAX implementation work. The taskbook is a local planning and safety gate; it is not a BPMAX configuration write path.
11
+
12
+ ## When To Use
13
+
14
+ - The user asks for an AI task plan, taskbook, implementation task table, subagent split, or progress tracking.
15
+ - 用户要求 AI任务方案、任务书、任务拆解、实施任务表、subagent 分工、进度表或 P0/P1 review。
16
+ - The work spans multiple BPMAX objects such as flow, form, dataset, list, filter, detail, dashboard, role, navigation, workspace, or E2E cases.
17
+ - The work may use subagents or parallel review.
18
+ - A new flow/app/workspace may be created and the real platform-generated ID must be fed back into later tasks.
19
+ - The user asks for P0/P1 review before commit or before continuing configuration.
20
+
21
+ Do not use this for a single narrow read-only query, one-field edit, or pure CLI auth/setup task.
22
+
23
+ ## Commands
24
+
25
+ Create the taskbook:
26
+
27
+ ```bash
28
+ bpmax-cli taskbook init --out .codex/tmp/TASKBOOK.md
29
+ ```
30
+
31
+ Lint the taskbook before execution:
32
+
33
+ ```bash
34
+ bpmax-cli taskbook lint --source .codex/tmp/TASKBOOK.md
35
+ ```
36
+
37
+ For taskbooks that do not create or edit flows, keep the same content gates but skip the generated `flow_type` rule:
38
+
39
+ ```bash
40
+ bpmax-cli taskbook lint --source .codex/tmp/TASKBOOK.md --allow-generated-flow-type-missing
41
+ ```
42
+
43
+ Lint each subagent or handoff prompt before dispatch:
44
+
45
+ ```bash
46
+ bpmax-cli taskbook lint-prompt --prompt-source .codex/tmp/TASK_PROMPT.md
47
+ ```
48
+
49
+ Initialize progress tracking:
50
+
51
+ ```bash
52
+ bpmax-cli taskbook progress init --source .codex/tmp/TASKBOOK.md --out .codex/tmp/taskbook-progress.csv
53
+ ```
54
+
55
+ ## Required Content
56
+
57
+ The taskbook must include:
58
+
59
+ - `目标与边界`
60
+ - `并行拆解硬规则`
61
+ - `阶段总览`
62
+ - `对象锁表`
63
+ - `AI 最小任务单元`
64
+ - `验收门禁`
65
+ - `停机点`
66
+ - `进度 CSV`
67
+
68
+ Every AI task row must include:
69
+
70
+ - `business_goal`: concrete business outcome, not just a technical object name.
71
+ - `required_skills`: concrete BPMAX skills such as `bpmax-flow-template-editor`, `bpmax-form-template-editor`, `bpmax-list-template-editor`, `bpmax-e2e-flow-test-operator`, or `bpmax-memory-protocol`.
72
+ - `object_lock`: one lock per mutable BPMAX object, for example `flow:<flow_type>`, `form-template:<id>`, `dataset:<id>`, `workspace:<key>`, or `new-flow:<name>`.
73
+ - `subagent_mode`: one of `none`, `readonly`, `draft-only`, or `exclusive-write`.
74
+ - `dependencies`: upstream task IDs required before execution.
75
+ - `evidence`: expected proof such as readback hash, browser screenshot, test report, or lint result.
76
+
77
+ ## Object Lock Rules
78
+
79
+ - Duplicate object locks must not be edited in parallel.
80
+ - Read-only tasks may run in parallel, but must not save, publish, or submit payloads.
81
+ - New flows must use `new-flow:<name>` until BPMAX returns a real `flow<number>`.
82
+ - After creation, replace the lock with `flow:<generated flow_type>` before dependent write tasks continue.
83
+ - Publishing, final sync, and cross-object integration must be single-threaded.
84
+
85
+ ## Prompt Gate
86
+
87
+ Before dispatching any subagent prompt, run `lint-prompt`. The prompt must explicitly include:
88
+
89
+ - `业务目标场景`
90
+ - `required_skills`
91
+ - `对象锁`
92
+ - `subagent_mode`
93
+ - `允许操作`
94
+ - `不得修改`
95
+ - `输入依赖`
96
+ - `输出物`
97
+ - `验收方式`
98
+ - `进度 CSV`
99
+
100
+ If `lint-prompt` fails, revise the prompt. Do not dispatch a vague prompt and rely on the subagent to infer scope.
101
+
102
+ ## Execution Gate
103
+
104
+ Only after taskbook lint and prompt lint pass:
105
+
106
+ 1. Run the latest configuration sync required by the target workspace.
107
+ 2. Execute tasks according to object locks and dependencies.
108
+ 3. Use typed `bpmax-cli config ...` commands for all BPMAX writes.
109
+ 4. Update the progress CSV after each task.
110
+ 5. Stop on capability gaps, baseline drift, object-lock conflict, failed lint, or failed browser/runtime verification.
111
+
112
+ 不得把 taskbook 当作 BPMAX 配置写入命令。Taskbook commands are local file gates; they do not write BPMAX configuration and do not replace typed adapters.
113
+
114
+ ## Memory
115
+
116
+ Start non-trivial taskbooks by consulting `bpmax-memory-protocol` or:
117
+
118
+ ```bash
119
+ bpmax-cli memory search --scope all --query "<workspace> <flow_type> taskbook implementation plan" --format json
120
+ ```
121
+
122
+ After verified completion, write only reusable `decision`, `task_learning`, `anti_pattern`, or `session_state` memory. Do not write API keys, passwords, cookies, tokens, verification codes, phone numbers, full payloads, or large raw API responses.
@@ -46,6 +46,7 @@ bpmax-cli init --agent <agent> --channel feishu --url "<BPMAX_URL>" --name local
46
46
  - 本地 schema manifest:读 `../bpmax-schema/SKILL.md`
47
47
  - 服务端能力白名单:先用 `capabilities status/refresh` 查看当前 profile 已授权 capability,不要绕过白名单手写 raw API
48
48
  - BPMAX Business Skills 查询、同步、安装、更新、卸载:读 `../bpmax-business-skill/SKILL.md`
49
+ - AI 任务方案、任务书、任务拆解、subagent 分工、实施任务表、进度 CSV:读 `../bpmax-ai-taskbook/SKILL.md`
49
50
 
50
51
  ## 规则
51
52
 
@@ -12,6 +12,7 @@ description: "用于按 BPMAX 完整流程配置需求先调研、再出计划
12
12
  - `required-collateral` 必须逐项解释“不改会坏/会失真/会不闭合”的原因并取得确认;`out-of-scope` 一律不得提交或顺手混入。
13
13
  - 不得以历史脏配置、顺手修复、统一风格、编辑器自动补字段、方便调试为理由修改需求外配置。
14
14
  - 所有远端写入必须走 `bpmax-cli config ...` typed adapter。没有相关流程且用户要求创建时,优先评估 `config flow-app create`;如果当前 profile 缺 `config.flow_app.create`、`config.form_template.create`、`config.flow_template.create` 或 `config.workspace_flow.submit`,必须停止并要求补授权/升级 CLI,不得改用 raw API、页面 fetch 或旧 submit 脚本。
15
+ - 大型、多对象、需要 subagent 或需要 P0/P1 review 的配置任务,必须先进入 [$bpmax-ai-taskbook](../bpmax-ai-taskbook/SKILL.md),生成并 lint AI 任务书,再开始分发执行;不得直接口头拆任务后写配置。
15
16
 
16
17
  ## 何时使用
17
18
  - 用户要做一整套 BPMAX 流程相关配置,而不是单改某一个模板。
@@ -55,6 +56,23 @@ bpmax-cli config flow-app create --workspace <workspace> --form-work <form-work-
55
56
  - 计划第一步固定先进入 `bpmax-config-latest` 并执行当前配置环境的 `bpmax-cli config latest pull <env>`;全部配置和验证结束后,最后一步固定再通过 `bpmax-config-latest` 执行一次同一环境的 latest pull。
56
57
  - 若首次同步因本地脏工作区失败,默认下一步尝试追加 `--allow-dirty` 重试;若重试任一步失败,立即停下并向用户说明冲突点,由用户决定是否继续。
57
58
 
59
+ ## AI 任务书门禁
60
+ - 当本次配置跨 2 个以上配置面、会创建新流程/工作区、需要 subagent 并行、或用户明确要求 review P0/P1 时,先调用 [$bpmax-ai-taskbook](../bpmax-ai-taskbook/SKILL.md)。
61
+ - 任务书必须先通过:
62
+
63
+ ```bash
64
+ bpmax-cli taskbook lint --source .codex/tmp/TASKBOOK.md
65
+ ```
66
+
67
+ - 每个 subagent prompt 必须先通过:
68
+
69
+ ```bash
70
+ bpmax-cli taskbook lint-prompt --prompt-source .codex/tmp/TASK_PROMPT.md
71
+ ```
72
+
73
+ - 任务书里必须声明对象锁、`required_skills`、`subagent_mode`、依赖和验收证据;对象锁冲突、prompt lint 失败、或真实 `flow_type` 未回填时不得分发写任务。
74
+ - `bpmax-cli taskbook progress init --source .codex/tmp/TASKBOOK.md --out .codex/tmp/taskbook-progress.csv` 生成的进度 CSV 是执行状态来源;不得直接改飞书文档当作进度事实。
75
+
58
76
  ## Mem0 协议
59
77
  - 编排开始前先调用 [$bpmax-memory-protocol](../bpmax-memory-protocol/SKILL.md),检索词至少包含:
60
78
  - 业务名 / 流程名
@@ -98,6 +116,7 @@ bpmax-cli config flow-app create --workspace <workspace> --form-work <form-work-
98
116
  - 列表模板
99
117
  - 筛选器模板
100
118
  - 导航配置
119
+ - 如果配置面超过 2 个,或存在新建/发布/多角色验收,计划中必须加入 `bpmax-ai-taskbook` 前置任务书步骤。
101
120
  - 如果用户说“全部都做”,按完整流程配置处理。
102
121
  - 如果用户只做一部分,只编排对应子 skill,不强行扩展到其他无关面。
103
122
  - 如果用户要求“没有就新建”,计划中必须显式写出:
@@ -125,6 +144,7 @@ bpmax-cli config flow-app create --workspace <workspace> --form-work <form-work-
125
144
  - 计划中要显式说明:
126
145
  - 哪些配置面属于本次范围
127
146
  - 哪些子 skill 会被调用
147
+ - 是否需要 `bpmax-ai-taskbook`,以及任务书 lint、prompt lint、进度 CSV 的路径
128
148
  - 哪些页面必须先在浏览器中打开
129
149
  - 哪些地方以浏览器实时配置为准
130
150
  - 新建场景使用哪个 typed create 命令、确认文本是什么、失败后停止在哪一步
@@ -141,6 +161,7 @@ bpmax-cli config flow-app create --workspace <workspace> --form-work <form-work-
141
161
  - 导航:[$bpmax-nav-config-editor](../bpmax-nav-config-editor/SKILL.md)
142
162
  - 控件选型:[$form-control-library](../form-control-library/SKILL.md)
143
163
  - 最新配置同步:[$bpmax-config-latest](../bpmax-config-latest/SKILL.md)
164
+ - AI 任务书:[$bpmax-ai-taskbook](../bpmax-ai-taskbook/SKILL.md)
144
165
  - 若流程或表单需求依赖控件能力判断,先用 [$form-control-library](../form-control-library/SKILL.md)。
145
166
  - 若某一步要求浏览器已打开特定页面,而当前页面不对,必须先让用户打开到正确页面,不要盲目继续。
146
167
  - `flow-app create` 完成后,必须再执行工作区视角的只读验证:
@@ -60,6 +60,29 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
60
60
  - 默认样板:`profiles/negative_sale.json`
61
61
  - 通用脚本优先读 `--profile <name>`;若场景还未收进目录,改用 `--profile-file <path>`
62
62
 
63
+ ## `.ai_test` 用例资产管理
64
+ - 可复用测试用例统一放在项目目录 `.ai_test/`,运行状态仍放在 `.codex/tmp/e2e_states/`;不要把二者混用。
65
+ - 生成、检查、更新用例资产前,必须先运行当前仓库对应的 `latest-*` 并显式使用 `ALLOW_DIRTY=1`,再把证明写入 `.codex/tmp/ai_test_suite/latest-<repo>-proof.json`。缺少 `--latest-proof` 时,CLI 必须拒绝 lint/index/draft-update/promote。
66
+ - 固定目录:
67
+ - 正式用例:`.ai_test/suite/<scenario_id>/`
68
+ - 待确认草稿:`.ai_test/suite_draft/<scenario_id>/`
69
+ - 执行报告:`.ai_test/report/<YYYYMMDD-NNN>/`
70
+ - 每个场景目录必须包含 `README.md` 和 `cases.csv`;promote 前还必须包含合格 `review.json`,证明已完成多视角 review 且未解决 P0/P1 为 0。
71
+ - `cases.csv` 字段必须固定为:`case_id,priority,type,title,preconditions,config_basis,prep_data,steps,expected_result,test_data,roles,evidence_required,tags,status,updated_at`。
72
+ - `config_basis` 必须指向真实存在的配置或能力依据,并说明覆盖原因。配置仓库使用 `think_*`、`.ai_test/`、`.codex/skills/`;`bpmax-cli` 包内能力可引用 `skills/`。
73
+ - 生成或更新用例必须先落到 `.ai_test/suite_draft/`,执行 lint 并向用户概要说明后,得到用户确认才允许 promote 到 `.ai_test/suite/`。
74
+ - 从正式用例复制到草稿,或从草稿 promote 到正式用例时,如果目标场景目录已经存在,第一次 `--replace` 只生成 copy diff preview,不覆盖目标;必须审阅 diff 后第二次显式追加 `--diff-reviewed`。
75
+ - 优先使用 `bpmax-cli test-suite` 原生命令:
76
+
77
+ ```bash
78
+ bpmax-cli test-suite lint --root .ai_test/suite_draft --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
79
+ bpmax-cli test-suite index --root .ai_test/suite --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
80
+ bpmax-cli test-suite draft-update --scenario customer-exchange-main-flow --replace --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
81
+ bpmax-cli test-suite promote --scenario customer-exchange-main-flow --replace --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
82
+ bpmax-cli test-suite next-report-dir --root .ai_test/report --create
83
+ bpmax-cli test-suite lint-report --root .ai_test/report
84
+ ```
85
+
63
86
  ## 负卖配置样板流程
64
87
  - 工作区:`store_mgr`
65
88
  - `flow_type`:`flow288204142`
@@ -402,3 +425,4 @@ PYTHON_BIN=./venv/bin/python
402
425
  - 浏览器保留点:`references/browser-only-checkpoints.md`
403
426
  - 筛选字段发现规则:`references/filter-field-discovery.md`
404
427
  - 经验教训覆盖矩阵:`references/skill-experience-coverage-matrix.md`
428
+ - `.ai_test` 用例资产规范:`references/ai-test-suite.md`
@@ -0,0 +1,321 @@
1
+ # `.ai_test` 用例资产规范
2
+
3
+ ## 目录结构
4
+
5
+ ```text
6
+ .ai_test/
7
+ suite/
8
+ <scenario_id>/
9
+ README.md
10
+ cases.csv
11
+ review.json
12
+ .copy_diff/
13
+ last.diff
14
+ last.json
15
+ suite_draft/
16
+ <scenario_id>/
17
+ README.md
18
+ cases.csv
19
+ review.json
20
+ .copy_diff/
21
+ last.diff
22
+ last.json
23
+ report/
24
+ <YYYYMMDD-NNN>/
25
+ summary.md
26
+ <scenario_id>.md
27
+ screenshots/
28
+ ```
29
+
30
+ `suite` 是正式用例库,`suite_draft` 是 AI 生成或更新后的待确认草稿,`report` 是每次运行的证据目录。
31
+
32
+ `.copy_diff/` 是覆盖同名场景目录时自动生成的覆盖审计证据,只在 `draft-update --replace` 或 `promote --replace` 的目标目录已存在时出现。
33
+
34
+ ## README 模板
35
+
36
+ ```markdown
37
+ # 客户换货主链路
38
+
39
+ scenario_id: customer-exchange-main-flow
40
+ workspace: store_mgr
41
+ flow_type: flow451422190
42
+ core: true
43
+ status: active
44
+ owner_skill: bpmax-e2e-flow-test-operator
45
+
46
+ ## 场景简介
47
+
48
+ 覆盖客户换货补录从发起、审批、库存联动到终态展示的主链路。
49
+
50
+ ## 适用范围
51
+
52
+ - PC 创建页:`https://yaditest.yitaiyitai.com/w:store_mgr/project/create?flow_type=flow451422190`
53
+ - 列表页:`https://yaditest.yitaiyitai.com/w:store_mgr/project?flow_type=flow451422190`
54
+ - 详情页:`https://yaditest.yitaiyitai.com/w:store_mgr/project_detail/<detail_template_id>/<project_id>`
55
+ - 待办处理页:`https://yaditest.yitaiyitai.com/w:store_mgr/projectContinue?id=<project_id>&step_id=<step_id>`
56
+
57
+ ## 选择规则
58
+
59
+ 当任务涉及客户换货、补录、库存联动、审批终态时,测试前必须优先加载本场景。
60
+ ```
61
+
62
+ ## cases.csv 字段
63
+
64
+ 字段必须完全一致:
65
+
66
+ ```csv
67
+ case_id,priority,type,title,preconditions,config_basis,prep_data,steps,expected_result,test_data,roles,evidence_required,tags,status,updated_at
68
+ ```
69
+
70
+ 字段说明:
71
+
72
+ - `case_id`:场景内唯一,建议 `C001`。
73
+ - `priority`:`P0`、`P1`、`P2`。
74
+ - `type`:`positive`、`negative`、`boundary`、`permission`、`data_consistency`、`regression`。
75
+ - `title`:短标题。
76
+ - `preconditions`:前置数据和环境。
77
+ - `config_basis`:每条用例依据的配置位置和覆盖原因,必须至少包含一个可定位位置,例如 `think_flow/...`、`think_form_template/...`、`think_data_set/...`、`think_data_set_field/...`、`think_flow_page_template/...`、`think_configuration/...`、`think_role/...`、`think_category/...`、`think_api_platform/...`、`think_api_proxy/...`、`think_workspace/...`、`.ai_test/...`、`skills/...` 或 `.codex/skills/...`,并说明为什么这条用例要覆盖该配置点。
78
+ - `prep_data`:结构化前置数据准备,至少包含 `账号=`、`入口=`、`样本=`、`准备操作=`、`预期=`。
79
+ - `steps`:可读步骤,用 ` > ` 分隔。
80
+ - `expected_result`:明确可判定结果。
81
+ - `test_data`:样本占位,不写 token、cookie、手机号、密码或完整 payload。
82
+ - `roles`:涉及角色,用逗号分隔。
83
+ - `evidence_required`:例如 `screenshot+project_detail`、`api+dataset`。
84
+ - `tags`:用于 AI 检索。
85
+ - `status`:`active`、`deprecated`、`draft`。
86
+ - `updated_at`:`YYYY-MM-DD`。
87
+
88
+ 示例:
89
+
90
+ ```csv
91
+ case_id,priority,type,title,preconditions,config_basis,prep_data,steps,expected_result,test_data,roles,evidence_required,tags,status,updated_at
92
+ C001,P0,positive,正常客户换货主链路,有可用旧机SN和新机库存,"think_flow/flow_type'flow451422190___key'___status'1___is_del'0/flow 校验主流程节点和审批链; think_data_set/.../data_set 覆盖库存联动落库依据","账号=store_staff,dealer_owner;入口=https://yaditest.yitaiyitai.com/w:store_mgr/project?flow_type=flow451422190;样本=新建换货样本;准备操作=确认旧机SN和新机库存可用并打开创建入口;预期=旧机SN和新机库存可被选择且审批人可达;主数据=旧机SN和新机库存",发起换货 > 填写旧机 > 填写新机 > 提交 > 审批通过,旧机入库,新机出库,项目终态正确,old_sn=sample;new_sn=sample,store_staff,dealer_owner,screenshot+project_detail,"core,inventory,approval",active,2026-06-18
93
+ ```
94
+
95
+ ## latest gate
96
+
97
+ - 生成、检查、更新 `.ai_test` 用例前,都必须先调用当前仓库对应的 `latest-*` 更新方法,并带 `ALLOW_DIRTY=1`。
98
+ - yaditest 仓库优先使用 `/latest-yaditest`;脚本等价命令必须显式设置 `ALLOW_DIRTY=1`。
99
+ - latest 后记录:命令、`ALLOW_DIRTY=1`、更新前后 `git rev-parse HEAD`、`git status --short` 摘要。
100
+ - latest 后必须写 `.codex/tmp/ai_test_suite/latest-<repo>-proof.json`,至少包含 `method`、`allow_dirty`、`before`、`after`、`head`、`status_short`。
101
+ - `bpmax-cli test-suite lint/index/draft-update/promote` 必须传 `--latest-proof <path>`;缺失或 proof 不合格时命令拒绝执行。
102
+ - latest 失败或远端基线无法确认时,不得继续生成、检查、更新或 promote 用例。
103
+
104
+ ## 配置依据规则
105
+
106
+ - 每条用例都必须填写 `config_basis`。
107
+ - `config_basis` 不是泛泛备注,必须同时满足:
108
+ - 至少一个可定位且当前仓库真实存在的配置位置,例如 `think_flow/.../flow`、`think_form_template/.../form_template`、`think_data_set/.../data_set`、`think_data_set_field/...`、`think_flow_page_template/...`、`think_configuration/.../configuration.content`、`think_role/...`、`think_category/...`、`think_api_platform/...`、`think_api_proxy/...`、`think_workspace/...`、`.ai_test/...`、`skills/...` 或 `.codex/skills/...`。
109
+ - 说明覆盖原因,例如“校验审批链”“覆盖字段显隐”“验证数据集落库”“对应列表展示列”“因为该节点存在自动创建子流程脚本”。
110
+ - `bpmax-cli test-suite lint` 会硬检查 `config_basis` 非空、包含可定位配置位置、路径真实存在、包含覆盖原因。
111
+ - 检查用例是否与配置一致时,必须逐行读取 `config_basis` 指向的位置,确认配置仍支持该用例;不能只看用例标题或历史报告。
112
+
113
+ ## 配置一致性检查规则
114
+
115
+ - 每次检查前必须先过 latest gate。
116
+ - 对 `cases.csv` 每条用例逐条给出判断:`正确`、`需更新`、`需废弃`、`需拆分` 或 `blocked`。
117
+ - 判断依据必须来自最新配置位置、运行态页面证据、接口回读或用户确认,不能只引用旧记忆。
118
+ - 除了检查已有用例,还必须反向扫最新配置是否有未覆盖内容:新增节点、条件分支、字段、校验、列表列、筛选字段、数据集落库、副作用、权限边界、自动化、子流程和消息。
119
+ - 如果发现应补充的新用例,必须走 `.ai_test/suite_draft/`、lint、用户确认、promote 流程;不能只在报告中留下建议。
120
+
121
+ ## 前置数据规则
122
+
123
+ - `prep_data` 是执行前必须先完成的准备清单,不是备注。
124
+ - 最少写明 `账号=`、`入口=`、`样本=`、`准备操作=`、`预期=`。
125
+ - `准备操作=` 必须写正式执行步骤前要做的具体动作,例如打开入口、创建或搜索样本、确认主数据、确认权限、确认自动化发布状态。
126
+ - `预期=` 必须写准备完成的可判定结果,例如样本可用、样本不存在、审批人可达、字段可选、自动生成的下游项目已存在。
127
+ - 复杂业务应补 `主数据=`、`权限=`、`自动化=`、`依赖流程=`、`清理策略=`。
128
+ - 当 `入口=` 包含 `<project_id>`、`<step_id>` 等占位符时,必须补 `绑定解析=`,说明如何取得真实运行态 ID。
129
+ - 当用例验证自动贯通、子流程或下游对象时,必须补 `定位规则=`,说明按列表 URL、`flow_type`、搜索字段、根项目关系或详情 URL 定位对象。
130
+ - `prep_data` 用英文分号 `;` 分隔字段,每一段都必须是 `key=value`;同一字段内多个值用英文逗号 `,` 分隔。
131
+ - 全流程自动贯通用例必须写清自动触发依据,不能用人工直接创建的下游项目冒充自动贯通。
132
+
133
+ ## 多 subagent review gate
134
+
135
+ 转正式执行或 promote 前,每个场景目录必须有 `review.json`。该文件证明本场景至少经过一次按 SKILL 要求的多 subagent review,并且没有未解决的 P0/P1。
136
+
137
+ 最小结构:
138
+
139
+ ```json
140
+ {
141
+ "scenario_id": "customer-exchange-main-flow",
142
+ "reviewed_at": "2026-06-18",
143
+ "status": "fixed",
144
+ "latest_proof": {
145
+ "method": "latest-yaditest",
146
+ "allow_dirty": true,
147
+ "before": "73a8dbb6a06f1c804ae8f7c911e608e392d0c035",
148
+ "after": "73a8dbb6a06f1c804ae8f7c911e608e392d0c035",
149
+ "head": "73a8dbb6a06f1c804ae8f7c911e608e392d0c035",
150
+ "status_short": "dirty worktree allowed for ai_test update"
151
+ },
152
+ "perspectives": [
153
+ {"name": "structure_lint", "reviewer": "subagent-structure", "status": "fixed", "summary": "结构与lint通过"},
154
+ {"name": "business_coverage", "reviewer": "subagent-business", "status": "fixed", "summary": "覆盖主链路和关键分支"},
155
+ {"name": "execution_operability", "reviewer": "subagent-execution", "status": "fixed", "summary": "入口、前置数据和证据可执行"},
156
+ {
157
+ "name": "config_consistency",
158
+ "reviewer": "subagent-config",
159
+ "status": "fixed",
160
+ "summary": "逐条核对配置依据",
161
+ "case_judgments": [
162
+ {
163
+ "case_id": "C001",
164
+ "status": "correct",
165
+ "config_basis_checked": ["think_flow/flow_type'flow614117990___key'___status'1___is_del'0/flow"],
166
+ "evidence": "配置路径存在,流程节点仍支持该用例"
167
+ }
168
+ ],
169
+ "missing_case_review": {"needed": false, "summary": "未发现必须补充的新用例"}
170
+ }
171
+ ],
172
+ "unresolved": {"P0": 0, "P1": 0, "P2": 1},
173
+ "fixes": ["修复 P1 lint 和执行性问题"]
174
+ }
175
+ ```
176
+
177
+ 要求:
178
+
179
+ - `perspectives` 必须至少包含 `structure_lint`、`business_coverage`、`execution_operability`、`config_consistency`。
180
+ - 每个 perspective 必须写 `summary`。
181
+ - `latest_proof` 必须记录 latest 方法、`ALLOW_DIRTY=1` 和基线 SHA。
182
+ - `config_consistency` 必须写 `case_judgments` 和 `missing_case_review`;每条用例必须有 `case_id`、判断状态、已检查配置位置和证据。
183
+ - `unresolved.P0` 和 `unresolved.P1` 必须为 `0`。
184
+ - `fixes` 不能为空;如果 review 无问题,也要写明“未发现 P0/P1,确认无需修复”。
185
+ - `promote` 命令会硬检查 `review.json`,缺失或不合格会拒绝转正式库。
186
+
187
+ ## 覆盖 diff gate
188
+
189
+ 从正式库复制到草稿,或从草稿 promote 到正式库时,如果目标场景目录已经存在,必须先 diff 源目录和目标目录,避免错误覆盖同名场景。
190
+
191
+ CLI 行为:
192
+
193
+ - `draft-update --replace`:目标草稿目录存在时,覆盖前比较正式目录和草稿目录。
194
+ - `promote --replace`:目标正式目录存在时,覆盖前比较草稿目录和正式目录。
195
+ - 覆盖完成后,目标目录会包含:
196
+ - `.copy_diff/last.diff`:覆盖前目标文件到源文件的 unified diff。
197
+ - `.copy_diff/last.json`:操作类型、场景 ID、源目录、目标目录、生成时间、增删改摘要和文件 hash。
198
+
199
+ 执行要求:
200
+
201
+ - 命令输出 `copy diff: .../.copy_diff/last.diff` 时,必须查看 diff 摘要。
202
+ - 如果 diff 中出现非预期删除、大范围覆盖、跨场景内容或与本任务无关的变更,必须停止 promote。
203
+ - `lint` 会校验 `.copy_diff/last.json` 和 `.copy_diff/last.diff`;如果 `.copy_diff/` 存在但结构缺失或损坏,场景不合格。
204
+
205
+ ## 浏览器入口规则
206
+
207
+ - 用例用于浏览器执行时,执行入口必须写成可打开的浏览器 URL 或运行态路由。
208
+ - 不要用表单 UUID、数据集 UUID、模板 ID 或配置文件路径作为执行入口。
209
+ - PC 端发起页必须使用 `/w:<workspace>/project/create?flow_type=<flow_type>`;`/pages/projectCreate/projectCreate` 只允许作为移动端或消息内嵌入口的明确场景。
210
+ - 对 YBS 工作区,详情页优先写列表模板实际跳转的 `https://yaditest.yitaiyitai.com/w:ybs/project_detail/0/<project_id>`;不要使用未验证的固定详情模板数字 ID。
211
+ - `evidence_required` 包含 `screenshot`、`project_detail` 或 `list` 的用例,`preconditions`、`steps` 或 `expected_result` 中必须出现 URL/路由。
212
+
213
+ ## 生成和确认
214
+
215
+ 生成新用例时,确认前只允许运行 lint:
216
+
217
+ ```bash
218
+ bpmax-cli test-suite lint \
219
+ --root .ai_test/suite_draft \
220
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
221
+ ```
222
+
223
+ 用户明确确认后,先完成多 subagent review gate,写入合格 `review.json`,再把 `README.md` 的 `status` 调整为 `active` 或 `deprecated`,最后运行 promote:
224
+
225
+ ```bash
226
+ bpmax-cli test-suite promote \
227
+ --scenario customer-exchange-main-flow \
228
+ --replace \
229
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
230
+ # 若目标已存在,先审阅 preview diff,再二次执行:
231
+ bpmax-cli test-suite promote \
232
+ --scenario customer-exchange-main-flow \
233
+ --replace \
234
+ --diff-reviewed \
235
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
236
+ ```
237
+
238
+ 不要把 lint 和 promote 连续执行成一个无确认命令块。
239
+
240
+ 更新已有用例时,确认前只允许运行 draft-update 和 lint:
241
+
242
+ ```bash
243
+ bpmax-cli test-suite draft-update \
244
+ --scenario customer-exchange-main-flow \
245
+ --replace \
246
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
247
+
248
+ # 若目标草稿已存在,先审阅 preview diff,再二次执行:
249
+ bpmax-cli test-suite draft-update \
250
+ --scenario customer-exchange-main-flow \
251
+ --replace \
252
+ --diff-reviewed \
253
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
254
+
255
+ bpmax-cli test-suite lint \
256
+ --root .ai_test/suite_draft \
257
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
258
+ ```
259
+
260
+ 如果 draft-update 输出 `copy diff preview: .../.copy_diff/last.diff`,概要中必须说明 diff 摘要和是否符合预期;未加 `--diff-reviewed` 前不会覆盖目标草稿。
261
+
262
+ 用户明确确认更新概要后,才运行 promote:
263
+
264
+ ```bash
265
+ bpmax-cli test-suite promote \
266
+ --scenario customer-exchange-main-flow \
267
+ --replace \
268
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
269
+
270
+ # 若目标正式库已存在,先审阅 preview diff,再二次执行:
271
+ bpmax-cli test-suite promote \
272
+ --scenario customer-exchange-main-flow \
273
+ --replace \
274
+ --diff-reviewed \
275
+ --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
276
+ ```
277
+
278
+ promote 前必须让用户确认概要,包括场景名、核心/一般、用例数量、优先级分布、类型分布、关键前置数据、copy diff 摘要和缺失依据。promote 输出 `copy diff preview: .../.copy_diff/last.diff` 时,必须确认 diff 符合预期并二次带 `--diff-reviewed` 后才算正式发布完成。
279
+
280
+ ## 报告模板
281
+
282
+ ```markdown
283
+ # 客户换货主链路测试报告
284
+
285
+ run_id: 20260618-001
286
+ scenario_id: customer-exchange-main-flow
287
+ source_suite: .ai_test/suite/customer-exchange-main-flow
288
+ result: pass
289
+ tested_at: 2026-06-18
290
+
291
+ ## 1. 测试范围
292
+
293
+ ## 2. 执行环境
294
+
295
+ ## 3. 用例执行结果
296
+
297
+ | case_id | title | result | sample | evidence |
298
+ |---|---|---|---|---|
299
+
300
+ ## 4. 截图证据
301
+
302
+ ![C001 创建页字段带出](/Users/<user>/<repo>/.ai_test/report/20260618-001/screenshots/customer-exchange-main-flow__C001__01.png)
303
+
304
+ Codex 桌面本地预览优先使用截图的绝对本地路径,图片文件仍必须位于本次运行目录的 `screenshots/` 下。普通 Markdown 阅读器可使用 `./screenshots/...`;飞书/外发版应先把本地图片上传并替换为可访问 URL。
305
+
306
+ ## 5. 接口 / 数据回读证据
307
+
308
+ ## 6. 发现问题
309
+
310
+ ## 7. 用例资产反馈
311
+
312
+ - 是否发现用例缺失
313
+ - 是否发现用例过期
314
+ - 是否建议更新或废弃
315
+ ```
316
+
317
+ 报告 lint:
318
+
319
+ ```bash
320
+ bpmax-cli test-suite lint-report --root .ai_test/report
321
+ ```
@@ -179,6 +179,7 @@ export BPMAX_BASE_URL='https://<your-bpmax-host>'
179
179
  - `return (async () => { ... })();`
180
180
  - `message_config_mode = code` / `cc_message_config_mode = code` 的消息模板同样由 `parseEvalFunction()` 执行,不能填写普通中文文案或 `${step...}` 字面量 URL:
181
181
  - `message_template` / `cc_message_template` 必须是 JS 函数体脚本,例如 `return "请处理...";`
182
+ - 空 `message_template` 会触发后端默认消息外发;主流程编排节点、系统等待节点或其它不应外发消息的节点,必须在 code 模式下显式写 `return "";`,不能留空。
182
183
  - `message_template_simple.actions[].url` / `m_url` 如需拼接 `step.project_id`、`step.id`,必须写成 `return '/projectContinue?id=' + step.project_id + '&step_id=' + step.id;`
183
184
  - typed CLI lint 已将该规则设为 hard error,不得用 `--allow-preexisting-lint-errors` 豁免。
184
185
  - 创建链路中 `meta.project_create_validator` 在单号/流水号生成之后执行。它可以拒绝缺失或不一致的数据,不能在不消耗流水号的前提下修复已经生成的单号;涉及 `sn_number.field_reference` 的问题,应优先在表单侧通过 `ctx.$setValueByKeyToValue(...)` 触发前端订阅刷新,流程级创建校验只做后端兜底拒绝。
@@ -39,6 +39,7 @@
39
39
  - 已把“填写订单信息”下沉到开始节点 `meta.form_template`,脚本却还在按旧节点 id 或旧节点表单取值
40
40
  - 表单字段前端查重把“查询”写成未确认后端已实现的 `POST /api/.../search`,结果命中 `BaseRest.postAction` 直接新增资源
41
41
  - `message_config_mode = code` / `cc_message_config_mode = code` 时,把普通中文文案写进 `message_template` / `cc_message_template`
42
+ - code-mode `message_template` 留空以为能阻止外发;实际会触发后端默认消息,必须显式写 `return "";`
42
43
  - code-mode 消息卡片按钮 URL 写成 `/projectContinue?id=${step?.project_id}&step_id=${step?.id}`,而不是 `return '/projectContinue?id=' + step.project_id + '&step_id=' + step.id;`
43
44
 
44
45
  ## 前端失焦查重专项核查
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: "bpmax-workspace-editor"
3
+ description: "用于在 BPMAX 中创建、编辑、导出、验证或删除平台工作区。只要用户提到“创建工作区”“编辑工作区配置”“workspace 配置”“工作区入口路径”“工作区管理员/白名单/icon/logo/背景图”“删除工作区”或等价表达,就应使用这个 skill。它要求 Codex 使用 bpmax-cli 的 typed `config workspace` adapter 完成 export、lint、build、submit、verify/delete 闭环,不得把它和本地配置库 `config workspace init <env>` 或流程绑定 `config workspace-flow` 混用。"
4
+ ---
5
+
6
+ # BPMAX Workspace Editor
7
+
8
+ ## 写入路径硬约束
9
+ - 执行前必须先运行 `bpmax-cli config adapters --format json` 核对 `workspace`;只有 `export_status`、`build_status`、`submit_status`、`create_status`、`delete_status` 都是 `supported` 时,才允许进入真实写入。
10
+ - 当前平台工作区配置只能走 typed CLI:
11
+ - 导出:`bpmax-cli config workspace export --id key:<workspace_key> --profile <profile> --format json`
12
+ - 构建:`bpmax-cli config workspace build --work <work-file> --meta <meta-file> --out <submit-file> --format json`
13
+ - 提交:`bpmax-cli config workspace submit --id <id|key:key> --payload <submit-file> --confirm "submit workspace <workspace_key>" --profile <profile> --format json`
14
+ - 新建:先准备 `mode=create` 的 work/meta,再用 `bpmax-cli config workspace create --id create:workspace --payload <submit-file> --confirm "submit workspace <workspace_key>" --profile <profile> --format json`
15
+ - 删除:`bpmax-cli config workspace delete --id <numeric_id> --confirm "delete workspace <numeric_id>" --profile <profile> --format json`
16
+ - 不得用 `bpmax-cli api POST/PUT/DELETE /workspace*`、浏览器 fetch、curl 或旧脚本绕过 typed adapter。
17
+ - 不要把本 skill 用于配置库目录初始化;配置库 clone/bind 使用 `bpmax-cli config workspace init <env> --workspace-dir <dir>`,对应 skill 是 `bpmax-config-latest`。
18
+ - 不要把本 skill 用于给工作区绑定流程;流程绑定使用 `bpmax-cli config workspace-flow build/submit`,通常由 `bpmax-flow-template-editor` 或 `bpmax-e2e-flow-config-orchestrator` 编排。
19
+
20
+ ## 范围门禁
21
+ - 修改前必须明确目标工作区 key、用户要求改哪些字段,以及哪些字段必须保持不变。
22
+ - 只允许改用户明确要求的工作区字段;不得顺手调整 `workspace_flow`、导航、角色、权限点或配置库环境。
23
+ - 对 `entry_path`、`m_entry_path`、`origin`、`white_list`、`admin_ids` 这类可能影响访问入口和权限的字段,提交前必须在 dry-run 中逐项说明变更。
24
+ - 删除工作区是高风险操作;必须确认 numeric id,且只在用户明确要求删除时执行。
25
+
26
+ ## Mem0 协议
27
+ - 开始前先调用 [$bpmax-memory-protocol](../bpmax-memory-protocol/SKILL.md),检索词至少包含:
28
+ - `workspace`
29
+ - 工作区 key / 名称
30
+ - `entry_path` / `admin_ids` / `white_list` / `icon` / `logo` 等本次相关字段
31
+ - 回读验证通过后,只写可复用结论:
32
+ - `decision`:工作区 key 命名、入口路径、管理员模型选择
33
+ - `task_learning`:某类工作区字段的稳定配置方式
34
+ - `anti_pattern`:误把平台工作区和配置库 workspace init 混用、raw API 绕过 typed adapter
35
+ - 不写 API Key、Authorization、密码、手机号、验证码、cookie、完整 payload 或大段接口响应。
36
+
37
+ ## 标准闭环
38
+ 1. 确认 profile 和能力:
39
+ ```bash
40
+ bpmax-cli auth status --profile <profile> --format json
41
+ bpmax-cli capabilities refresh --profile <profile> --format json
42
+ bpmax-cli config adapters --format json
43
+ ```
44
+ 2. 编辑现有工作区:
45
+ ```bash
46
+ bpmax-cli config workspace export --id key:<workspace_key> --profile <profile> --out .codex/tmp/workspace-editor --format json
47
+ bpmax-cli config workspace lint --work .codex/tmp/workspace-editor/work/workspace-key-<workspace_key>.json --format json
48
+ bpmax-cli config workspace build --work <work-file> --meta <meta-file> --out <submit-file> --format json
49
+ bpmax-cli config workspace submit --id key:<workspace_key> --payload <submit-file> --profile <profile> --format json
50
+ bpmax-cli config workspace submit --id key:<workspace_key> --payload <submit-file> --confirm "submit workspace <workspace_key>" --profile <profile> --format json
51
+ ```
52
+ 3. 新建工作区:
53
+ - work 文件必须包含 `mode: "create"`、`name`、`key`、`entry_path`。
54
+ - `key` 必须 2-20 位,字母开头,只能包含字母、数字、`_`、`-`。
55
+ - `entry_path` 默认可用 `/myProject`,但必须确认是否符合业务入口。
56
+ ```bash
57
+ bpmax-cli config workspace build --work <create-work-file> --meta <create-meta-file> --out <submit-file> --format json
58
+ bpmax-cli config workspace create --id create:workspace --payload <submit-file> --profile <profile> --format json
59
+ bpmax-cli config workspace create --id create:workspace --payload <submit-file> --confirm "submit workspace <workspace_key>" --profile <profile> --format json
60
+ ```
61
+ 4. 验证:
62
+ ```bash
63
+ bpmax-cli config workspace export --id key:<workspace_key> --profile <profile> --format json
64
+ ```
65
+ 必须确认回读中的 `name`、`key`、`entry_path`、`m_entry_path`、`origin`、`admin_ids`、`white_list` 与预期一致。
66
+
67
+ ## 字段约束
68
+ - `name`:2-20 字符。
69
+ - `key`:2-20 位,字母开头,只能包含字母、数字、`_`、`-`。命令输入可写 `w:<key>` 或 `key:<key>`,提交 payload 会规范成纯 key。
70
+ - `entry_path`:必填,决定 PC 默认入口。
71
+ - `m_entry_path`:移动端入口;不确定时保持原值或空字符串。
72
+ - `is_system_admin`、`admin_ids`、`white_list`:权限相关字段,必须按用户要求或导出现状保守保留。
73
+ - `logo`、`bg_img`、`icon`、`description`、`origin`:只在需求明确时修改。
74
+
75
+ ## 验收
76
+ - dry-run 输出必须显示 endpoint、method、payload 和 diff。
77
+ - confirmed submit 后必须有 readback hash。
78
+ - 浏览器验收时打开 `.../w:<workspace_key>/workspaceConfiguration/<workspace_key>` 或当前平台对应工作区配置页,确认名称、入口、图标和管理员范围显示正确。
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "BPMAX Workspace Editor"
3
+ short_description: "创建或编辑 BPMAX 平台工作区配置"
4
+ default_prompt: "使用 $bpmax-workspace-editor 根据需求创建或编辑 BPMAX 平台工作区配置,并通过 typed CLI 完成回读验证。"