tuistory
Skill này làm gì
Skill này chạy các chương trình terminal trong phiên ẩn, để agent có thể gõ vào chúng và đọc những gì hiện ra. Nó dành cho lập trình viên kiểm thử ứng dụng dòng lệnh và giao diện văn bản.
Khi nào nên dùng
- ✓Khi ai đó muốn kiểm thử một ứng dụng terminal có tương tác.
- ✓Khi lỗi trong ứng dụng terminal cần được tái hiện từng bước.
- ✓Khi một môi trường không có giao diện cần kiểm tra giao diện văn bản.
Liên kết skill
https://github.com/cline/cline/blob/main/.cline/skills/tuistory/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể mở ứng dụng dòng lệnh của chúng tôi, gõ vài lệnh và cho tôi biết màn hình hiển thị gì không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent khởi động chương trình trong một phiên nền có tên và gửi các phím bấm. Nó chờ văn bản mong đợi xuất hiện và chụp ảnh màn hình.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
tuistory
tuistory wraps any terminal command in a named background PTY session backed by a Ghostty terminal emulator. Agents interact with the session via short CLI calls that return instantly; humans can tuistory attach to the same session to watch or intervene. No real terminal or display (DISPLAY) is needed — it works fully headless, which makes it the preferred way for cloud agents to exercise the Cline TUI.
It is installed as a devDependency of @cline/cli, so the pinned binary resolves when you run from apps/cli:
cd apps/cli
bunx tuistory --help # source of truth for commands, options, and syntax
For full upstream docs: curl -s https://raw.githubusercontent.com/remorses/tuistory/refs/heads/main/README.md
Driving the Cline TUI headlessly
Launch the TUI in an isolated environment so you don't touch real user config (~/.cline):
cd apps/cli
DATA_DIR=$(mktemp -d) && HOME_DIR=$(mktemp -d)
bunx tuistory -s cline --cols 120 --rows 36 \
--env HOME=$HOME_DIR --env CLINE_DATA_DIR=$DATA_DIR \
--env CLINE_DISABLE_CLINE_PASS_NOTICE=1 --env CLINE_TELEMETRY_DISABLED=1 \
-- bun src/index.ts --provider anthropic -m claude-sonnet-4-6 -k test-key
The dummy -k test-key renders the full chat UI; only an actual agent turn would fail. For recorded LLM turns, use the VCR cassettes described in apps/cli/src/tests/helpers/env.ts (CLINE_VCR=playback + CLINE_VCR_CASSETTE). Real turns need a provider credential (e.g. ANTHROPIC_API_KEY, CLINE_API_KEY).
Then use an observe → act → observe loop:
# Wait reactively for the chat view — never use sleep
bunx tuistory -s cline wait "What can I do for you?" --timeout 30000
# Act, then always observe the resulting screen state
bunx tuistory -s cline type "/settings"
bunx tuistory -s cline snapshot --trim
bunx tuistory -s cline press enter
bunx tuistory -s cline snapshot --trim
# Styled PNG of the current screen (prints the file path) — good for artifacts
bunx tuistory -s cline screenshot
# Full raw output stream (snapshot shows only the visible screen)
bunx tuistory read -s cline --all
# Tear down a session YOU started (double Ctrl+C exits the TUI cleanly)
bunx tuistory -s cline press ctrl c
bunx tuistory -s cline press ctrl c
bunx tuistory -s cline close
Background processes (instead of tmux)
bunx tuistory -s my-server -- bun run dev:sidecar # returns immediately
bunx tuistory -s my-server wait "/listening|ready/i" --timeout 30000
bunx tuistory read -s my-server # new output since last read
bunx tuistory -s my-server restart # after code changes
Key rules
- Options before
--, command after. Everything after the first--is passed verbatim to the child:tuistory -s name --cols 150 -- bun src/index.tsis correct. - Snapshot after every action. TUIs are stateful; dialogs and errors can render over the view you expect.
snapshotreflects what the user actually sees (occluded text does not count), unlike grepping the raw stream. - Wait, never sleep.
wait "text"/wait "/regex/i"(case-sensitive by default) reacts as fast as the terminal updates;wait-idlewhen you don't know what to expect. Always pass--timeout. - Keys land instantly. Unlike sleep-based scripts, a queued second keypress can leak into the next view (e.g. one Enter both accepts a slash completion and submits it).
- Never close a session you didn't start. Sessions are shared with humans (
tuistory attach -s name) and other agents. Default to leaving sessions running; useread/wait/snapshotto inspect without disrupting. --cols/--rowsaffect TUI layout (assertions are width-sensitive);--pixel-ratio 2gives sharper screenshots.
Writing e2e tests with the library API
apps/cli/src/cli.tuistory.e2e.test.ts (run: bun run test:e2e:tuistory) is the reference. The programmatic API runs in-process — no daemon:
import { launchTerminal } from "tuistory";
const session = await launchTerminal({
command: "bun",
args: ["src/index.ts", "--provider", "anthropic", "-k", "test-key"],
cwd: cliRoot,
env: isolatedEnv, // see createCliEnv() in the reference test
cols: 120,
rows: 36,
waitForDataTimeout: 30_000, // CLI cold start compiles a large TS graph
});
await session.waitForText("What can I do for you?", { timeout: 30_000 });
const screen = await session.text({ trimEnd: true }); // emulated screen
Câu hỏi thường gặp
Nó có cần màn hình hay display thật không?
Không. Skill cho biết nó hoạt động hoàn toàn không cần giao diện, không cần terminal thật hay màn hình.
Người khác có thể xem phiên không?
Có. Skill cho biết một người có thể gắn vào cùng phiên để xem hoặc can thiệp.
Tôi tìm tùy chọn lệnh ở đâu?
Skill cho biết đầu ra trợ giúp của chính công cụ là nguồn chuẩn cho lệnh và cú pháp.
Chi tiết
Mô tả gốc của tác giả
Drive and test terminal apps (especially the Cline CLI TUI in apps/cli) through tuistory — named background PTY sessions that agents can read, wait on, snapshot, screenshot, and type into. Like Playwright/tmux for terminals, with reactive waiting instead of blind `sleep`. Use this skill when you need to: - Manually test or reproduce bugs in the interactive Cline TUI (`bun run cli -i`) from a headless environment - Run a dev server or any long-lived/interactive process in the background without hanging your tool call - Write or extend Playwright-style e2e tests for the TUI (`bun run test:e2e:tu
repo: cline/cline
Độ phổ biến
- Sao GitHub
- 71k
- Vị trí xếp hạng
- #3108
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
cline-sdk
71kDạy agent của bạn xây dựng AI agent bằng Cline SDK, bao gồm tool, phiên làm việc, sự kiện, nhà cung cấp mô hình và các đội nhiều agent.
create-pull-request
71kGiúp agent của bạn tạo pull request trên GitHub với tiêu đề và mô tả rõ ràng, theo template của dự án và kiểm tra nhánh trước.
opentui
71kGiúp agent của bạn xây giao diện người dùng terminal bằng OpenTUI, bao gồm bố cục, xử lý bàn phím, thành phần, hoạt ảnh và kiểm thử.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.