画布
- 作者仓库星标 39
- 许可证 MIT
- 作者仓库 awesome-omni-skill
- 领域
- 设计与多媒体
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 94 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @diegosouzapw · MIT
- 上下文用量评级
- 中等消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- Bun
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
cd ${SKILL_DIR}
# Display calendar in current terminal
bun run src/cli.ts show calendar
# Spawn interactive meeting picker in tmux split
bun run src/cli.ts spawn calendar --scenario meeting-picker --config '{
"calendars": [
{"name": "Alice", "color": "blue", "events": [...]},
{"name": "Bob", "color": "green", "events": [...]}
]
}'
# Canvas TUI Toolkit
Interactive terminal displays (TUIs) that spawn in tmux split panes and communicate via IPC. Use for calendars, documents, flight bookings, and other rich interactive scenarios.
## When to Use
- Displaying calendars and picking meeting times
- Showing markdown documents with text selection
- Comparing flights and selecting seats
- Any scenario requiring visual display + user interaction
- When you need to show rich content without blocking the conversation
## Quick Start
```bash
cd ${SKILL_DIR}
# Display calendar in current terminal
bun run src/cli.ts show calendar
# Spawn interactive meeting picker in tmux split
bun run src/cli.ts spawn calendar --scenario meeting-picker --config '{
"calendars": [
{"name": "Alice", "color": "blue", "events": [...]},
{"name": "Bob", "color": "green", "events": [...]}
]
}'
```
## Available Canvas Types
| Canvas | Purpose | Scenarios |
|--------|---------|-----------|
| `calendar` | Display calendars, pick meeting times | `display`, `meeting-picker` |
| `document` | View/edit markdown documents | `display`, `edit`, `email-preview` |
| `flight` | Flight comparison and seat selection | `booking` |
## Spawning Canvases
**Always use `spawn` for interactive scenarios** - opens canvas in tmux split pane.
```bash
bun run src/cli.ts spawn [kind] --scenario [name] --config '[json]'
```
**Parameters:**
- `kind`: Canvas type (calendar, document, flight)
- `--scenario`: Interaction mode
- `--config`: JSON configuration for the canvas
- `--id`: Optional canvas instance ID for IPC
## Calendar Canvas
### Display Scenario
View-only calendar display.
```bash
bun run src/cli.ts show calendar --config '{
"title": "My Week",
"events": [
{
"id": "1",
"title": "Meeting",
"startTime": "2026-01-07T09:00:00",
"endTime": "2026-01-07T10:00:00"
}
]
}'
```
### Meeting Picker Scenario
Interactive time slot selection across multiple calendars.
```bash
bun run src/cli.ts spawn calendar --scenario meeting-picker --config '{
"calendars": [
{
"name": "Alice",
"color": "blue",
"events": [
{"id": "1", "title": "Standup", "startTime": "2026-01-07T09:00:00", "endTime": "2026-01-07T09:30:00"}
]
}
],
"slotGranularity": 30,
"minDuration": 30,
"maxDuration": 120
}'
```
**Controls:**
- Mouse click: Select a free time slot
- `←/→`: Navigate weeks
- `t`: Jump to today
- `q` or `Esc`: Cancel
**Returns:**
```json
{
"startTime": "2026-01-07T14:00:00",
"endTime": "2026-01-07T15:00:00",
"duration": 60
}
```
## Document Canvas
### Display Scenario
Read-only markdown document.
```bash
# Spawn in new tmux pane (recommended)
bun run src/cli.ts spawn document --config '{
"content": "# Hello World\n\nThis is **markdown**.",
"title": "My Document"
}'
# Or show inline in current terminal
bun run src/cli.ts show document --config '{
"content": "# Hello World\n\nThis is **markdown**.",
"title": "My Document"
}'
```
### Edit Scenario
Interactive document with text selection and diff highlighting.
```bash
bun run src/cli.ts spawn document --scenario edit --config '{
"content": "# Blog Post\n\nSelect some text here.",
"title": "Edit Mode",
"diffs": [
{"startOffset": 20, "endOffset": 30, "type": "add"}
]
}'
```
**Controls:**
- Mouse click and drag: Select text
- `↑/↓`: Navigate document
- `q`: Close
**Returns:**
```json
{
"selectedText": "some text",
"startOffset": 12,
"endOffset": 21,
"startLine": 3,
"endLine": 3
}
```
## Flight Canvas
### Booking Scenario
Flight comparison and seat selection with cyberpunk theme.
```bash
bun run src/cli.ts spawn flight --scenario booking --config '{
"flights": [
{
"id": "ua123",
"airline": "United Airlines",
"flightNumber": "UA 123",
"origin": {
"code": "SFO",
"name": "San Francisco International",
"city": "San Francisco",
"timezone": "PST"
},
"destination": {
"code": "DEN",
"name": "Denver International",
"city": "Denver",
"timezone": "MST"
},
"departureTime": "2026-01-08T12:55:00-08:00",
"arrivalTime": "2026-01-08T16:37:00-07:00",
"duration": 162,
"price": 34500,
"currency": "USD",
"cabinClass": "economy",
"aircraft": "Boeing 737-800",
"stops": 0,
"seatmap": {
"rows": 30,
"seatsPerRow": ["A", "B", "C", "D", "E", "F"],
"aisleAfter": ["C"],
"unavailable": ["1A", "1B", "1C"],
"premium": ["2A", "2B"],
"occupied": ["3A", "4B"]
}
}
]
}'
```
**Controls:**
- `↑/↓`: Navigate between flights
- `Tab`: Switch to seatmap
- `←/→/↑/↓` (in seatmap): Move cursor
- `Space`: Select seat
- `Enter`: Confirm
- `q`: Cancel
**Returns:**
```json
{
"selectedFlight": { ... },
"selectedSeat": "12A"
}
```
## IPC Communication
Canvases communicate via Unix domain sockets.
**Canvas → Controller:**
```typescript
{ type: "ready", scenario } // Canvas ready
{ type: "selected", data } // User made selection
{ type: "cancelled", reason? } // User cancelled
{ type: "error", message } // Error occurred
```
**Controller → Canvas:**
```typescript
{ type: "update", config } // Update canvas config
{ type: "close" } // Close canvas
{ type: "ping" } // Health check
```
## Programmatic API
```typescript
import { pickMeetingTime, editDocument, bookFlight } from "${SKILL_DIR}/src/api";
// Meeting picker
const meeting = await pickMeetingTime({
calendars: [...],
slotGranularity: 30,
});
// Document editor
const doc = await editDocument({
content: "# My Document",
title: "Edit Mode",
});
// Flight booking
const flight = await bookFlight({
flights: [...]
});
```
## Requirements
- **tmux**: Canvas spawning requires active tmux session
- **Bun**: Runtime for executing canvas commands
- **Terminal with mouse support**: For interactive scenarios
## File Structure
```
canvas/
├── SKILL.md # This file
├── README.md # Additional documentation
├── package.json # Dependencies
├── run-canvas.sh # Wrapper script
├── src/
│ ├── cli.ts # CLI entry point
│ ├── canvases/ # React/Ink canvas components
│ ├── scenarios/ # Scenario definitions
│ ├── ipc/ # IPC server/client
│ └── api/ # High-level API
└── scripts/ # Helper scripts
```
## Tips
- Always check for tmux session before spawning: `tmux list-sessions`
- Use `show` for quick displays, `spawn` for interactive scenarios
- Canvas IDs are optional but useful for managing multiple canvases
- IPC sockets are created in `/tmp/canvas-*.sock`
- Canvases auto-cleanup on exit or error
## Examples
### Example 1: Pick Meeting Time
```bash
# User: "Find a time for Alice and Bob to meet tomorrow"
# You: Spawn meeting picker
bun run src/cli.ts spawn calendar --scenario meeting-picker --config '{
"calendars": [
{"name": "Alice", "color": "blue", "events": [...]},
{"name": "Bob", "color": "green", "events": [...]}
],
"slotGranularity": 30
}'
# Wait for selection, then confirm with user
```
### Example 2: Review Document
```bash
# User: "Show me the email draft"
# You: Display email in document canvas
bun run src/cli.ts spawn document --config '{
"content": "Dear Team,\n\nPlease review...",
"title": "Email Draft"
}'
```
### Example 3: Book Flight
```bash
# User: "Compare these flights and pick a seat"
# You: Spawn flight booking canvas
bun run src/cli.ts spawn flight --scenario booking --config '{
"flights": [...]
}'
# Wait for user to select flight + seat
```
章节与文件索引
按说明文件中的顺序排列。
何时使用
可用的画布类型
产卵画布
显示场景
会议选择器场景
文件/命令 -> calendar · display · meeting-picker · document · edit · email-preview · flight · booking
内容校验值 -> a72dcc3d0f49
当前原文的自动摘译,尚未人工审校。
何时使用
显示日历和选择会议时间 显示带有文本选择的 Markdown 文档 比较航班和选择座位 任何需要视觉显示 + 用户交互的场景 当您需要在不阻塞对话的情况下显示丰富的内容时
可用的画布类型
画布 · 用途 · 场景
calendar· 显示日历、选择会议时间 ·display、meeting-pickerdocument· 查看/编辑 Markdown 文档 ·display、edit、email-previewflight· 航班比较和座位选择 ·booking产卵画布
始终使用
spawn进行交互场景 - 在 tmux 拆分窗格中打开画布。参数:kind:画布类型(日历、文档、航班)--scenario:交互模式--config:画布的 JSON 配置显示场景
仅供查看的日历显示。
会议选择器场景
跨多个日历的交互式时段选择。控制: 单击鼠标:选择空闲时段
←/→:导航周t:跳转到今天