# Cawplan Testplan Layout

> Orchestrate CawPlan QA Insights TestRail test plans from Version/Ticket-scoped imported cases with preview-first workflow. Use when: creating or executing A2 TestRail Plans/Runs for a CawPlan version or one or more CawPlan tickets after cases have been imported. NOT for: importing test cases (use `cawplan-testcase-import`); generating test points; execution summaries; defect filing; release risk. Do NOT use `cawplan api GET /api/v1/public/openapi/product/{product_id}` to resolve product name — that route does not exist.

- Skill: `cawcut/cawplan-testplan-layout` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add cawcut/cawplan-testplan-layout`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cawcut/cawplan-testplan-layout/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: cawcut (https://skillmd.com/u/cawcut)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cawcut/cawplan-testplan-layout

---


# CawPlan TestPlan Layout — A2 测试计划编排

```bash
cawplan skill check
```

## 硬门禁（MUST）

1. **preview-first**：禁止跳过 preview 直接 `plan execute`。
2. **execute 仅用 `preview_id`**；禁止 execute 前重算范围或改 Milestone / `ticket_reuse_strategy`。
3. **Milestone 名** = `{product_name} {version_name}`（禁止 `{version_name} - QA Execution`）。
4. **Ticket 增量编排**：默认 `ticket_reuse_strategy=AUTO`（BE 默认）；已绑定 Ticket `REUSE` 不新建 Run；全量重建须 preview 时显式 `--ticket-reuse-strategy CREATE_ALL`。
5. **阻断性 gap** → 硬禁止 execute。见 `ux.md §Gaps`。
6. **用户展示**：`ux.md §Glossary`；UUID/`preview_id` 默认隐藏；跟随用户主语言；Agent 自行 `AskUserQuestion`。
7. **双确认闸**：预览决策闸（Step 3）→ 执行提交闸（Step 5 `--confirm`）。
8. **plan-rules set**：仅 SQA 明确要求调整 R1–R7 时执行。
9. **首次 Milestone 闸门**：`mapping-get` 返回 `has_mapping=false` 时，**禁止**跳过框 M 直接 `plan preview`（`§Intent` 命中或 `§ConfirmState` 复用除外）。
10. **非首次免询问**：`has_mapping=true` 时**禁止**弹框 M；直接 `AUTO` preview。框 M 或 Intent 确认后至 execute 前**禁止**改 `milestone_strategy` / `milestone_id`。

## Reference 加载（MUST）

| 时机 | Read | 禁止 |
|------|------|------|
| Step 0 / preview / execute CLI | `execution.md` | 一次性 Read 全部 references |
| Step 1.5 / 1.6 / Milestone 首次确认 | `execution.md §MilestoneProbe` · `§MilestoneValidate` · `§MilestoneFirstLayout` | — |
| 交互、preview、gap、确认闸 | `ux.md` | — |
| Milestone REUSE 二次确认（Step 2.1） | `execution.md §Incremental` · `ux.md §Prompts` | — |

## 允许命令

- `plan-rules get`（默认）；`plan-rules set`（仅用户明确要求）
- `milestone mapping-get`、`milestone validate`
- `plan preview`（可选 `--milestone-strategy`、`--milestone-id`、`--ticket-reuse-strategy`）、`plan execute`
- `products list`、`versions list`

**禁止**：`cawplan api`、链式 `&&`、手动传 `suite_id`、直连 TestRail。

## Workflow

| Step | 动作 | Detail |
|------|------|--------|
| **0** | 解析 `product_id`/`version_id`/名称；编排范围 | `execution.md §0` · 缺信息 → `ux.md §Prompts` |
| **1** | `plan-rules get`；用户要求才 `set` | `execution.md §Rules` |
| **1.5** | `milestone mapping-get` | `execution.md §MilestoneProbe` |
| **1.5a** | `has_mapping=false` → **框 M**（默认新建） | `ux.md §MilestoneFirstConfirm` · `§ConfirmState` |
| **1.6** | 框 M 选「绑定已有」→ `milestone validate`（Intent `REUSE_BY_ID` 免本步） | `execution.md §MilestoneValidate` |
| **2** | `plan preview`（策略见 `§MilestoneFirstLayout` 或 `AUTO`） | `execution.md §Preview` · `§Incremental` |
| **2.1** | `AUTO` + `REUSE` + `LATEST_MAPPING` → Milestone 二次确认 | `ux.md §Prompts` · 框 M / Intent 已确认则跳过 |
| **3** | 友好 preview → **预览决策闸** | `ux.md`；`NEW_CASES_NOT_IN_RUN` 须确认 |
| **4** | 无阻断 gap 且过闸 → **执行提交闸** | `ux.md §Prompts` |
| **5** | `plan execute --preview-id … --confirm` | `execution.md §Execute` |

## 输出

主文禁止默认展示 UUID。`plan_count`/`run_count` = **将新建**（不含 REUSE）。

```markdown
## 测试计划编排结果 — {product_name} {version_name}

| 项目 | 内容 |
|------|------|
| 里程碑 | [{milestone.name}]({milestone.url}) |
| 工单范围 | {全版本 / ticket 列表} |
| 复用 | {to_reuse_ticket_count} 个工单沿用已有 Run |
| 新建 | {to_create_ticket_count} 个工单 · {plan_count} 计划 · {run_count} 运行 |

### 按工单
| 工单 | 处理方式 | 计划/运行 | 链接 |
|------|----------|-----------|------|
| {display_id} | 复用/新建 | … | [查看](url) |
```

用户要「技术详情」时再展开：`preview_id`、`plan_mapping_id`、`reused_plan_mapping_ids`、`created_plan_mapping_ids`、`confirmed_milestone_strategy`。

## References

- [execution.md](references/execution.md) — 范围、CLI、Milestone 探测、增量编排、R1–R7、execute
- [ux.md](references/ux.md) — 友好名、框 M、ConfirmState、确认闸、gap/warning、AskUserQuestion

