← 返回 Skills 市场
inertia186

headless-terminal

作者 Anthony Martin · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
40
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install headless-terminal
功能描述
Drive hostile or full-screen terminal UIs through the `ht` CLI from montanaflynn/headless-terminal. Use when an agent needs reliable PTY-backed interaction,...
使用说明 (SKILL.md)

Headless Terminal

Overview

Use ht from \x3Chttps://github.com/montanaflynn/headless-terminal> as the special-purpose tool for terminal programs that behave badly under plain stdin/stdout control. It gives a real PTY, terminal-state snapshots, and explicit wait conditions so the agent can drive a TUI without guessing when the screen settled.

Do not let the hammer make everything look like a nail. ht is powerful but heavyweight; if a normal command, pipe, exec with pty=true, or tmux session fits better, use that instead.

Workflow

  1. Confirm ht exists before committing to this path.
  2. Decide whether the task actually needs ht; explicitly reject hammer/nail overuse and try simpler shell or host-agent primitives first when they fit.
  3. Create a uniquely named session with ht run.
  4. Send the smallest meaningful keystrokes.
  5. Wait for a deterministic condition.
  6. Snapshot with ht view.
  7. Stop and remove the session when done, unless the user explicitly wants a persistent session.

Choose ht vs other tools

Use ht when:

  • a program needs a real tty and redraws the whole screen
  • alternate-screen behavior matters
  • cursor position or screen state matters
  • the task needs reliable waits after keys are sent
  • you want a text or PNG snapshot of the terminal state

Prefer exec / process when:

  • the command is ordinary shell I/O
  • output is line-oriented and does not depend on screen state
  • no full-screen TUI is involved
  • exec with pty=true is enough to satisfy a TTY check without needing screen snapshots

Prefer tmux when:

  • a human will monitor or resume the session directly
  • persistence and shared human visibility matter more than terminal snapshots

Preflight

Check availability first:

command -v ht

If ht is missing, say so plainly and switch to another tool or ask whether to install it. The expected install source is Montana Flynn's headless-terminal:

brew install montanaflynn/tap/ht

Without Homebrew, use a release tarball from \x3Chttps://github.com/montanaflynn/headless-terminal/releases> that matches the host OS/architecture, then put the ht binary on PATH.

Security/trust posture for publishing:

  • Tap installs and release tarballs are still trust decisions; name the repo/owner explicitly.
  • Prefer the tap or release artifacts over random packages or copy-pasted scripts.
  • If a user is security-sensitive, suggest reviewing the GitHub repo and release page before installation. Important disambiguation: not every package named ht or headless-terminal is this CLI. On macOS/Homebrew, the core formula ht refers to HTE, a viewer/editor/analyzer for executables, not this terminal automation tool. The public npm package headless-terminal is an old library and may not provide the expected ht run / ht send CLI. Do not install either as a guess; verify that the candidate explicitly supports the commands this skill uses.

Core commands

ht run --name demo-$(date +%s) \x3Ccmd...>
ht send demo "keys..." --wait-idle 200ms --view
ht view demo
ht view demo --format png > screenshot.png
ht wait demo --wait-text "READY"
ht stop demo
ht remove demo

Treat command names and flags as version-sensitive. If ht --help is available, check it before relying on less-common flags such as PNG output or cursor waits.

Waiting strategy

This is the main reason to use ht.

Prefer, in order:

  1. --wait-text when a known string should appear
  2. --wait-cursor when the cursor position is predictable
  3. --wait-idle when the app redraws and then settles
  4. --wait-duration only when nothing better exists

Do not rely on blind sleeps when a real wait condition is available.

Practical patterns

Drive vim safely

ht run --name notes vim /tmp/notes.md
ht send notes "ihello\x3CEsc>" --wait-idle 200ms --view
ht send notes ":wq\x3CCR>" --wait-exit
ht remove notes

Drive a remote TUI over SSH

ht run --name remote ssh [email protected]
ht send remote "top\x3CCR>" --wait-idle 500ms --view
ht send remote "q" --wait-idle 200ms
ht send remote "exit\x3CCR>" --wait-exit
ht remove remote

Inspect git add -p

ht run --name addp git add -p
ht view addp

Then send one choice at a time and wait after each response.

Operating guidance

  • Use unique named sessions so follow-up commands stay readable and do not collide with older runs.
  • Send the minimum keystrokes needed; avoid giant pasted blobs.
  • After any state-changing input, capture a fresh view before assuming success.
  • If the screen looks wrong, inspect with ht view before sending more keys.
  • Clean up exited sessions with ht remove.
  • Ask before using ht for privacy-sensitive auth flows, remote systems, or destructive TUI operations. A real PTY can make it easy to do real damage quickly.

Failure modes

  • If the program exits immediately, check the command, working directory, and whether the program refuses non-interactive/unknown terminals.
  • If waits time out, use a different wait condition instead of stacking longer sleeps.
  • If the captured screen is stale or blank, check whether the app uses an alternate screen, requires a larger terminal size, or has already exited.
  • If a task is simple enough for plain shell control, stop using ht and simplify.
  • If the session is for a human to keep around, tmux is usually the better container.

References

  • references/examples.md: quick fit checks, sample command patterns, and wait-strategy examples
  • references/keys.md: vim-style key notation such as \x3CCR>, \x3CEsc>, arrows, control/meta keys, and raw bytes
  • references/waits.md: wait strategy decision tree and timeout guidance
  • references/recipes.md: recipes for vim, REPLs, installers, watch, terminal sizing, screenshots, and recording
  • references/troubleshooting.md: exit codes, stale views, wait timeouts, zombies, daemon issues, and ht debug
安全使用建议
Before installing or using this skill, verify that the `ht` binary comes from Montana Flynn's headless-terminal project, not an unrelated package. Use it only for terminal UIs that truly need PTY-backed control, approve any remote/auth/destructive workflow in advance, inspect screen snapshots before sending more keys, and remove sessions and captures when finished.
功能分析
Type: OpenClaw Skill Name: headless-terminal Version: 1.0.0 The headless-terminal skill provides a legitimate interface for driving terminal user interfaces (TUIs) using the 'ht' CLI tool from montanaflynn/headless-terminal. The documentation (SKILL.md and references/) is thorough, emphasizing safe practices such as session cleanup, unique naming, and explicit warnings regarding the security implications of PTY-backed automation. It includes helpful disambiguation to prevent the installation of unrelated packages and lacks any indicators of malicious intent, data exfiltration, or deceptive prompt injection.
能力评估
Purpose & Capability
The stated purpose matches the artifacts: using the `ht` CLI to control full-screen or hostile terminal UIs. This is inherently powerful because it can run interactive commands and send keystrokes, but the behavior is clearly disclosed and purpose-aligned.
Instruction Scope
The instructions repeatedly narrow use to cases where a PTY/screen snapshot is needed, prefer simpler tools for ordinary shell work, and tell the agent to ask before privacy-sensitive, remote, or destructive flows.
Install Mechanism
There is no install spec and metadata declares no required binary, while the documentation requires the external `ht` CLI. The artifacts name the expected GitHub/Homebrew source and warn against false-friend packages, so this is a disclosed user trust decision rather than hidden installation behavior.
Credentials
The skill has no code files, credentials, or automatic install behavior, but it is meant to operate in the local terminal environment and may reach files, installers, SSH sessions, or auth prompts depending on the user task.
Persistence & Privilege
`ht` sessions and the daemon can persist beyond one command, and the references include recording/background examples. The main workflow instructs cleanup and says persistence should only be kept when the user explicitly wants it.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install headless-terminal
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /headless-terminal 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial public release. Adds ht guidance, wait/sync strategy, install-source trust notes, and anti-overuse guardrails.
元数据
Slug headless-terminal
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

headless-terminal 是什么?

Drive hostile or full-screen terminal UIs through the `ht` CLI from montanaflynn/headless-terminal. Use when an agent needs reliable PTY-backed interaction,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 40 次。

如何安装 headless-terminal?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install headless-terminal」即可一键安装,无需额外配置。

headless-terminal 是免费的吗?

是的,headless-terminal 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

headless-terminal 支持哪些平台?

headless-terminal 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 headless-terminal?

由 Anthony Martin(@inertia186)开发并维护,当前版本 v1.0.0。

💬 留言讨论