Skip to main content

tui-applications

Patterns for controlling TUI applications (vim, htop, tig, lazygit, etc.) via terminalcp

来源信息

仓库
code-yeongyu/sisyphus-private
最近来源活动
2025年11月2日 08:33
检测到的 SKILL.md 语言
英语
星标
17
分支
2

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
tui-applications
description
Patterns for controlling TUI applications (vim, htop, tig, lazygit, etc.) via terminalcp
# TUI Applications Control with terminalcp This skill provides comprehensive patterns for automating Text User Interface (TUI) applications using terminalcp MCP. It enables AI agents to control interactive terminal applications with full visual feedback. ## Overview terminalcp enables: - Full PTY terminal emulation for TUI apps - ANSI color and cursor positioning preservation - Complex key sequence automation - Screen content capture and parsing - Multi-TUI session management The MCP server runs via `npx @mariozechner/terminalcp@latest --mcp` and provides complete terminal rendering. ## Vim/Neovim Automation ### Starting Vim/Neovim ```json // Open file in vim { "action": "start", "command": "vim myfile.txt", "name": "vim-session" } // Open file in neovim { "action": "start", "command": "nvim myfile.txt", "name": "nvim-session" } // Start vim without file { "action": "start", "command": "vim", "name": "vim-session" } ``` ### Vim Mode Navigation ```json // Enter insert mode { "action": "stdin", "id": "vim-session", "data": "i" } // Type text { "action": "stdin", "id": "vim-session", "data": "Hello, World!" } // Exit insert mode (Escape) { "action": "stdin", "id": "vim-session", "data": "\u001b" } // Move cursor (in normal mode) { "action": "stdin", "id": "vim-session", "data": "h" // left } { "action": "stdin", "id": "vim-session", "data": "j" // down } { "action": "stdin", "id": "vim-session", "data": "k" // up } { "action": "stdin", "id": "vim-session", "data": "l" // right } ``` Note: `\u001b` is the Escape key in MCP notation. ### Vim Editing Commands ```json // Delete line { "action": "stdin", "id": "vim-session", "data": "dd" } // Undo { "action": "stdin", "id": "vim-session", "data": "u" } // Redo { "action": "stdin", "id": "vim-session", "data": "\u0012" // Ctrl+R } // Copy line (yank) { "action": "stdin", "id": "vim-session", "data": "yy" } // Paste { "action": "stdin", "id": "vim-session", "data": "p" } // Find and replace { "action": "stdin", "id": "vim-session", "data": ":%s/old/new/g\r" } ``` ### Vim File Operations ```json // Save file { "action": "stdin", "id": "vim-session", "data": ":w\r" } // Save and quit { "action": "stdin", "id": "vim-session", "data": ":wq\r" } // Quit without saving { "action": "stdin", "id": "vim-session", "data": ":q!\r" } // Open another file { "action": "stdin", "id": "vim-session", "data": ":e another_file.txt\r" } // Save as { "action": "stdin", "id": "vim-session", "data": ":saveas newfile.txt\r" } ``` ### Vim Search and Navigation ```json // Search forward { "action": "stdin", "id": "vim-session", "data": "/search_term\r" } // Search backward { "action": "stdin", "id": "vim-session", "data": "?search_term\r" } // Next search result { "action": "stdin", "id": "vim-session", "data": "n" } // Previous search result { "action": "stdin", "id": "vim-session", "data": "N" } // Go to line { "action": "stdin", "id": "vim-session", "data": ":42\r" } // Go to end of file { "action": "stdin", "id": "vim-session", "data": "G" } // Go to beginning of file { "action": "stdin", "id": "vim-session", "data": "gg" } ``` ### Vim Visual Mode ```json // Enter visual mode { "action": "stdin", "id": "vim-session", "data": "v" } // Select text (move cursor while in visual mode) { "action": "stdin", "id": "vim-session", "data": "jjj" // Select 3 lines down } // Copy selection { "action": "stdin", "id": "vim-session", "data": "y" } // Exit visual mode { "action": "stdin", "id": "vim-session", "data": "\u001b" } ``` ### Capturing Vim Screen ```json { "action": "stdout", "id": "vim-session" } ``` This returns the full terminal rendering including vim's UI, status line, and content. ## System Monitoring TUIs ### htop ```json // Start htop { "action": "start", "command": "htop", "name": "htop-session" } // Navigate processes { "action": "stdin", "id": "htop-session", "data": "\u001b[B" // Down arrow } { "action": "stdin", "id": "htop-session", "data": "\u001b[A" // Up arrow } // Sort by CPU { "action": "stdin", "id": "htop-session", "data": "P" } // Sort by memory { "action": "stdin", "id": "htop-session", "data": "M" } // Filter processes { "action": "stdin", "id": "htop-session", "data": "F4" } { "action": "stdin", "id": "htop-session", "data": "python\r" } // Kill process { "action": "stdin", "id": "htop-session", "data": "F9" } // Capture current state { "action": "stdout", "id": "htop-session" } // Quit { "action": "stdin", "id": "htop-session", "data": "q" } ``` ### btop ```json // Start btop { "action": "start", "command": "btop", "name": "btop-session" } // Toggle menu { "action": "stdin", "id": "btop-session", "data": "m" } // Switch views { "action": "stdin", "id": "btop-session", "data": "1" // CPU view } { "action": "stdin", "id": "btop-session", "data": "2" // Memory view } { "action": "stdin", "id": "btop-session", "data": "3" // Network view } // Capture state { "action": "stdout", "id": "btop-session" } ``` ## Git TUIs ### tig ```json // Start tig (git commit history viewer) { "action": "start", "command": "tig", "name": "tig-session" } // Navigate commits { "action": "stdin", "id": "tig-session", "data": "j" // Next commit } { "action": "stdin", "id": "tig-session", "data": "k" // Previous commit } // View commit details { "action": "stdin", "id": "tig-session", "data": "\r" // Enter to view diff } // Search { "action": "stdin", "id": "tig-session", "data": "/search_term\r" } // View specific branch { "action": "stdin", "id": "tig-session", "data": ":toggle refs\r" } // Capture view { "action": "stdout", "id": "tig-session" } // Quit { "action": "stdin", "id": "tig-session", "data": "q" } ``` ### lazygit ```json // Start lazygit { "action": "start", "command": "lazygit", "name": "lazygit-session" } // Navigate panels { "action": "stdin", "id": "lazygit-session", "data": "1" // Files panel } { "action": "stdin", "id": "lazygit-session", "data": "2" // Branches panel } { "action": "stdin", "id": "lazygit-session", "data": "3" // Commits panel
在 GitHub 查看
这个 SKILL.md 很大,SkillsMP 这里只预览前一段内容。 在 GitHub 查看