Tui Validate 标志

Tui Validate

社区热门
mikeyobrien
tui-validate

Validates Terminal User Interface (TUI) output using freeze for screenshot capture and LLM-as-judge for semantic validation. Supports both visual (PNG/SVG) and text-based validation modes.

Add to TypingMind

概览

发布者mikeyobrien
代码仓库ralph-orchestrator
技能名称tui-validate
星标数
3.2K
复刻数
299
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 mikeyobrien 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Tui Validate AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/mikeyobrien/ralph-orchestrator/tree/main/.claude/skills/tui-validate
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mikeyobrien/ralph-orchestrator.git /tmp/ralph-orchestrator
mkdir -p .claude/skills
cp -r /tmp/ralph-orchestrator/.claude/skills/tui-validate .claude/skills/tui-validate
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Tui Validate,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Tui Validate。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Tui Validate 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

TUI Validate

Overview

This skill validates Terminal User Interface (TUI) applications by capturing their output and using LLM-as-judge for semantic validation. It leverages freeze from Charmbracelet for high-fidelity terminal screenshots and provides structured validation criteria.

Philosophy: Rather than brittle string matching, this skill uses semantic understanding to validate that TUI output "looks right" - checking layout, content presence, and visual hierarchy without breaking on minor formatting changes.

When to Use

  • Validating TUI rendering after changes
  • Checking that UI components display correctly
  • Visual regression testing for terminal applications
  • Verifying TUI state after specific interactions
  • Creating documentation screenshots with validation

Prerequisites

Required:

  • freeze CLI tool installed (brew install charmbracelet/tap/freeze)
  • tmux for interactive TUI capture (optional, for live applications)

Verification:

bash
# Check freeze is installed
freeze --version

# Check tmux is installed (for interactive capture)
tmux -V

Parameters

  • target (required): What to validate. One of:

    • file:<path> - ANSI output file to validate
    • command:<cmd> - Command to execute and capture
    • tmux:<session> - Live tmux session to capture
    • buffer:<text> - Raw text/ANSI to validate
  • criteria (required): Validation criteria. Can be:

    • A predefined criteria name (see Built-in Criteria)
    • A custom criteria string describing what to check
  • output_format (optional, default: "svg"): Screenshot format

    • svg - Vector format, best for documentation
    • png - Raster format, best for visual diff
    • text - Text-only extraction, fastest
  • save_screenshot (optional, default: false): Whether to save the screenshot

    • If true, saves to {target_name}.{format} in current directory
  • judge_mode (optional, default: "semantic"): Validation approach

    • semantic - LLM judges based on meaning and layout
    • strict - Also checks exact content presence
    • visual - Requires PNG, checks visual appearance

Built-in Criteria

ralph-header

Validates Ralph TUI header component:

  • Iteration counter in [iter N] or [iter N/M] format
  • Elapsed time in MM:SS format
  • Hat indicator with emoji and name
  • Mode indicator (▶ auto or ⏸ paused)
  • Optional scroll mode indicator [SCROLL]
  • Optional idle countdown idle: Ns

ralph-footer

Validates Ralph TUI footer component:

  • Activity indicator (◉ active, ◯ idle, or ■ done)
  • Last event topic display
  • Search mode display when active

ralph-full

Validates complete Ralph TUI layout:

  • Header section at top (3 lines)
  • Terminal content area (variable height)
  • Footer section at bottom (3 lines)
  • Proper visual hierarchy and borders

tui-basic

Generic TUI validation:

  • Has visible content (not blank)
  • No rendering artifacts or broken characters
  • Proper terminal dimensions

Execution Flow

1. Capture Phase

Capture TUI output based on target type:

For file targets:

bash
freeze {file_path} -o /tmp/tui-capture.{format}

For command targets:

bash
freeze --execute "{command}" -o /tmp/tui-capture.{format}

For tmux targets:

bash
tmux capture-pane -pet {session} | freeze -o /tmp/tui-capture.{format}

For buffer targets:

bash
echo "{buffer}" | freeze -o /tmp/tui-capture.{format}

Constraints:

  • You MUST verify freeze is installed before attempting capture
  • You MUST handle capture failures gracefully and report the error
  • You MUST use appropriate freeze flags for the output format
  • You SHOULD use --theme base16 for consistent rendering
  • You SHOULD set reasonable dimensions with --width and --height

2. Extraction Phase

Extract content for LLM analysis:

For text/semantic validation:

  • If format is text, use the captured text directly
  • If format is svg or png, also capture text version for content analysis

For visual validation:

  • Requires PNG format
  • Will analyze the image directly using vision capabilities

Constraints:

  • You MUST extract both visual and text representations when judge_mode is visual
  • You MUST preserve ANSI escape sequences for color validation when relevant

3. Validation Phase

Apply LLM-as-judge with the appropriate criteria:

Semantic Validation Prompt Template:

Analyze this terminal UI output and determine if it meets the following criteria:

CRITERIA:
{criteria_description}

TERMINAL OUTPUT:
{captured_text}

Evaluate each criterion and provide:
1. PASS or FAIL for each requirement
2. Brief explanation for any failures
3. Overall verdict: PASS or FAIL

Be lenient on exact formatting but strict on:
- Required content presence
- Logical layout and hierarchy
- No rendering errors or artifacts

Visual Validation Prompt Template (with image):

Examine this terminal screenshot and validate:

CRITERIA:
{criteria_description}

Check for:
1. Visual hierarchy and layout
2. Color coding correctness
3. No rendering artifacts or broken characters
4. Proper alignment and spacing

Verdict: PASS or FAIL with explanation

Constraints:

  • You MUST return a clear PASS or FAIL verdict
  • You MUST provide specific feedback on failures
  • You MUST be lenient on whitespace/formatting differences
  • You MUST be strict on content presence and semantic correctness
  • You SHOULD note any warnings even on PASS results

4. Reporting Phase

Report validation results:

On PASS:

✅ TUI Validation PASSED

Criteria: {criteria_name}
Target: {target}
Mode: {judge_mode}

All requirements satisfied.
{optional_notes}

On FAIL:

❌ TUI Validation FAILED

Criteria: {criteria_name}
Target: {target}
Mode: {judge_mode}

Issues found:
- {issue_1}
- {issue_2}

Screenshot saved: {path_if_saved}

Constraints:

  • You MUST always provide a clear verdict
  • You MUST list specific issues on failure
  • You MUST offer the screenshot path if saved
  • You SHOULD suggest fixes for common issues

Examples

Example 1: Validate Ralph Header from File

Input:

/tui-validate file:test_output.txt criteria:ralph-header

Process:

  1. Read test_output.txt containing ANSI output
  2. Capture with freeze: freeze test_output.txt -o /tmp/capture.svg
  3. Extract text content
  4. Apply ralph-header criteria via LLM judge
  5. Report PASS/FAIL with details

Example 2: Validate Live TUI in tmux

Input:

/tui-validate tmux:ralph-session criteria:ralph-full save_screenshot:true

Process:

  1. Capture tmux pane: tmux capture-pane -pet ralph-session | freeze -o ralph-session.svg
  2. Also capture text: tmux capture-pane -pet ralph-session > /tmp/text.txt
  3. Apply ralph-full criteria checking header, content, and footer
  4. Save screenshot to ralph-session.svg
  5. Report validation result

Example 3: Custom Criteria Validation

Input:

/tui-validate command:"cargo run --example tui_demo" criteria:"Shows a bordered box with 'Hello World' text centered inside" output_format:png judge_mode:visual

Process:

  1. Execute command and capture: freeze --execute "cargo run --example tui_demo" -o /tmp/capture.png
  2. Use vision model to analyze PNG
  3. Check for bordered box and centered text
  4. Report visual validation result

Example 4: Quick Text Validation

Input:

/tui-validate buffer:"[iter 3/10] 04:32 | 🔨 Builder | ▶ auto" criteria:ralph-header output_format:text

Process:

  1. Analyze text directly (no freeze needed for text mode with buffer)
  2. Check for iteration format, elapsed time, hat, and mode indicator
  3. Report validation result

Criteria Definitions

ralph-header (Full Definition)

yaml
name: ralph-header
description: Ralph TUI header component validation
requirements:
  - name: iteration_counter
    description: Shows iteration in [iter N] or [iter N/M] format
    required: true
    pattern: '\[iter \d+(/\d+)?\]'

  - name: elapsed_time
    description: Shows elapsed time in MM:SS format
    required: true
    pattern: '\d{2}:\d{2}'

  - name: hat_indicator
    description: Shows current hat with emoji prefix
    required: true
    examples: ["🔨 Builder", "📋 Planner", "🎯 Executor"]

  - name: mode_indicator
    description: Shows loop mode status
    required: true
    values: ["▶ auto", "⏸ paused"]

  - name: scroll_indicator
    description: Shows [SCROLL] when in scroll mode
    required: false
    pattern: '\[SCROLL\]'

  - name: idle_countdown
    description: Shows idle timeout when present
    required: false
    pattern: 'idle: \d+s'

ralph-footer (Full Definition)

yaml
name: ralph-footer
description: Ralph TUI footer component validation
requirements:
  - name: activity_indicator
    description: Shows current activity state
    required: true
    values: ["◉ active", "◯ idle", "■ done"]

  - name: event_topic
    description: Shows last event topic
    required: false
    examples: ["task.start", "build.done", "loop.terminate"]

  - name: search_display
    description: Shows search query and match count when searching
    required: false
    pattern: 'Search: .+ \d+/\d+'

ralph-full (Full Definition)

yaml
name: ralph-full
description: Complete Ralph TUI layout validation
requirements:
  - name: header_section
    description: Header at top with iteration, time, hat, and mode
    required: true
    references: ralph-header

  - name: content_section
    description: Main terminal content area
    required: true
    checks:
      - Has visible content or is ready for content
      - Properly bounded between header and footer

  - name: footer_section
    description: Footer at bottom with activity status
    required: true
    references: ralph-footer

  - name: visual_hierarchy
    description: Clear visual separation between sections
    required: true
    checks:
      - Borders or spacing between sections
      - Consistent width across sections

Troubleshooting

freeze not found

bash
# macOS
brew install charmbracelet/tap/freeze

# Linux (via Go)
go install github.com/charmbracelet/freeze@latest

# Verify installation
freeze --version

tmux capture fails

  • Ensure the tmux session exists: tmux list-sessions
  • Verify pane number: tmux list-panes -t {session}
  • Try capturing specific pane: tmux capture-pane -pet {session}:{pane}

Rendering artifacts in capture

  • Try different terminal emulator settings in freeze
  • Use --theme flag for consistent colors
  • Ensure terminal dimensions match TUI expectations

LLM judge too strict/lenient

  • Adjust criteria to be more specific
  • Use strict mode for exact matching requirements
  • Use semantic mode for layout/presence checking

Integration with Tests

This skill can be integrated into test suites:

rust
// In tests/tui_validation.rs
#[test]
#[ignore] // Run with: cargo test -- --ignored
fn validate_header_rendering() {
    // 1. Render header to buffer
    let output = render_header_to_string(&test_state);

    // 2. Save to temp file
    std::fs::write("/tmp/header_test.txt", &output).unwrap();

    // 3. Run tui-validate skill (via CLI or programmatic)
    // /tui-validate file:/tmp/header_test.txt criteria:ralph-header

    // 4. Assert validation passed
}

Best Practices

  1. Use semantic validation for layout checks - Don't break on minor formatting
  2. Use strict validation for content requirements - Ensure critical info is present
  3. Save screenshots on failure - Aids debugging
  4. Test with various terminal sizes - TUIs should be responsive
  5. Combine with unit tests - Use this for integration/visual validation, unit tests for logic

常见问题

Tui Validate AI 技能有什么作用?

Validates Terminal User Interface (TUI) output using freeze for screenshot capture and LLM-as-judge for semantic validation. Supports both visual (PNG/SVG) and text-based validation modes.

为什么在 TypingMind 中使用 Tui Validate?

因为您只需安装一次,就能搭配任何模型使用。Tui Validate 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Tui Validate?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/mikeyobrien/ralph-orchestrator/tree/main/.claude/skills/tui-validate。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Tui Validate?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Tui Validate 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Tui Validate 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Tui Validate AI 技能免费吗?

是的。mikeyobrien 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇