---
name: generate-sap-prototype
description: Generate SAP-style UI prototype images from Markdown table definitions. Use when users ask to create SAP interface prototypes, SAP screenshots, SAP input screens, or visual mockups of SAP forms. Supports Input, Radio-Button, Check-Box, and Select-option field types.
isolated-context: false
allowed-tools: execute read_file write_file
---
# SAP Prototype Generator

Generate high-quality SAP interface prototype images from field definitions.

## Instructions

Use the execute tool to run the SAP prototype generation script:

```python
execute(command='python scripts/generate.py "<markdown_table>" output.png "title"')
```

### Example

```python
execute(command='python scripts/generate.py "
| 字段描述 | 展示类型 | 是否必输 |
|---------|---------|---------|
| 销售订单 | Input | 是 |
| 创建日期 | Input | 否 |
| 客户编号 | Input | 是 |
" "prototype.png" "销售订单查询"')
```

## Input Format

Markdown table with these columns:

| Column   | Required | Description                                |
| -------- | -------- | ------------------------------------------ |
| 字段描述 | Yes      | Field label                                |
| 展示类型 | Yes      | Input/Radio-Button/Check-Box/Select-option |
| 是否必输 | No       | 是/否                                      |
| 默认值   | No       | Default value                              |

> **For complete format specification, examples, and common mistakes to avoid, see [references/markdown-format.md](references/markdown-format.md).**

## Supported Field Types

- **Input**: Standard text input field
- **Radio-Button**: Single selection option
- **Check-Box**: Boolean toggle
- **Select-option**: Range selection (dual inputs with "到")

## Workflow

1. Parse Markdown table to extract field definitions
2. Generate HTML with embedded CSS based on field types
3. Render HTML to PNG using Playwright
4. Return path to generated image

## Error Handling

- Invalid Markdown: Clear error message with expected format
- Missing Playwright: Install instruction provided
- Rendering failure: Falls back to basic HTML structure

## ✅ AFTER ALL TOOLS: PROVIDE SUMMARY

**IMPORTANT:** After completing all tool calls, you MUST provide a natural language summary to the user.

Say something like:
"✅ SAP 原型图生成完成！
- 生成的界面：[界面标题]
- 字段数量：X 个
- 字段类型：[Input/Radio-Button/Check-Box/Select-option]
- 保存位置：[文件路径]
- 预览：[图像已生成，可查看]"

**DO NOT end with just the tool call - your final message must be a text summary!**
