cli-anything-iterm2
Skill này làm gì
Skill này cho phép agent làm việc bên trong iTerm2, ứng dụng terminal của Mac, bằng cách đọc và gửi văn bản tới các phiên của nó. Nó dành cho lập trình viên dùng iTerm2 và muốn tự động hóa công việc terminal.
Khi nào nên dùng
- ✓Khi bạn muốn agent gửi một lệnh tới một phiên iTerm2 đang chạy.
- ✓Khi bạn muốn đọc đầu ra hiện tại hoặc lịch sử của một phiên terminal.
- ✓Khi bạn muốn cửa sổ, tab hoặc các khung chia được sắp xếp tự động.
Liên kết skill
https://github.com/HKUDS/CLI-Anything/blob/main/iterm2/agent-harness/cli_anything/iterm2_ctl/skills/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
“Mở một tab iTerm2 mới, chạy bộ kiểm thử ở đó và cho tôi xem 50 dòng đầu ra cuối cùng.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill kết nối với iTerm2 qua Python API của nó, rồi đọc hoặc gửi văn bản tới các phiên bạn chọn. Đầu ra có thể hiển thị dạng JSON cho agent.
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.
cli-anything-iterm2
Stateful CLI harness for iTerm2. Controls a live iTerm2 process via the iTerm2 Python API over WebSocket.
Prerequisites
- macOS + iTerm2 running:
brew install --cask iterm2 - Python API enabled: iTerm2 → Preferences → General → Magic → Enable Python API
- Install:
pip install cli-anything-iterm2(orpip install -e .from source)
Basic Syntax
cli-anything-iterm2 [--json] <group> <command> [OPTIONS] [ARGS]
Always use --json for machine-readable output (required for agent use).
Command Groups
| Group | Purpose |
|---|---|
app |
App status, workspace snapshot, context management, app-level variables, modal dialogs, file panels |
window |
Create, list, close, resize, fullscreen windows |
tab |
Create, list, close, activate tabs; navigate split panes by direction |
session |
Send text, inject raw bytes, read screen, full scrollback, split panes, prompt detection |
profile |
List profiles, get profile details, list/apply color presets |
arrangement |
Save and restore window layouts |
tmux |
Full tmux -CC integration: bootstrap, connections, windows, commands |
broadcast |
Sync keystrokes across panes via broadcast domains |
menu |
Invoke any iTerm2 menu item programmatically |
pref |
Read/write global iTerm2 preferences; list all valid keys; tmux settings |
Orienting in an Existing Workspace
Use app snapshot when you land in a session with existing panes and need to understand what's running without reading full screen contents for each pane:
cli-anything-iterm2 --json app snapshot
Returns name, current directory, foreground process, user.role label, and last visible output line for every session across all windows.
Naming convention — label panes when setting up a workspace so you can find them later:
cli-anything-iterm2 session set-var user.role "api-server"
cli-anything-iterm2 session set-var user.role "log-tail"
cli-anything-iterm2 session set-var user.role "editor"
app snapshot will surface these roles alongside process and path, giving you a full picture in one call.
Typical Agent Workflow
# 1. Orient — snapshot every session: name, path, process, role, last output line
cli-anything-iterm2 --json app snapshot
# 2. Establish context (saves window/tab/session IDs for subsequent commands)
cli-anything-iterm2 app current
# 3. Interact — no --session-id needed once context is set
cli-anything-iterm2 session send "git status"
cli-anything-iterm2 --json session scrollback --tail 200 --strip
# 4. Create a multi-pane workspace — label panes so snapshot identifies them later
cli-anything-iterm2 session split --vertical --use-as-context
cli-anything-iterm2 session send "python3 -m http.server 8000"
cli-anything-iterm2 session set-var user.role "http-server"
Reference Files
Read only what the task requires — each file is a single narrow concern (~10–30 lines):
| File | Read when you need... |
|---|---|
references/session-io.md |
Send text, inject bytes, read screen/scrollback, get selection |
references/session-control.md |
Split panes, activate/close sessions, resize, rename, session variables |
references/session-shell-integration.md |
wait-prompt, wait-command-end, get-prompt; reliable send→wait→read pattern |
references/layout-window-tab.md |
Create/close/resize windows and tabs, navigate split panes |
references/layout-arrangement.md |
Save and restore window layouts |
references/app-context.md |
Snapshot (orientation), status, context management, app vars, modal dialogs, file panels |
references/profile-pref.md |
Profiles list/get/presets, preferences read/write, tmux pref shortcuts |
references/broadcast-menu.md |
Broadcast keystrokes to multiple panes, invoke menu items |
references/tmux-commands.md |
All tmux CLI commands (bootstrap, send, tabs, create-window, set-visible) |
references/tmux-guide.md |
Full tmux -CC workflow, pane→session ID mapping |
references/json-session.md |
--json schemas for session, window, tab, screen, scrollback, inject |
references/json-tmux-app.md |
--json schemas for tmux, app dialogs, preferences, errors |
REPL Mode
Run without arguments for an interactive REPL that maintains context between commands:
cli-anything-iterm2
Câu hỏi thường gặp
Tôi cần thiết lập gì?
Bạn cần iTerm2 trên macOS và bật Python API trong tùy chọn của nó.
Nó có chạy trên Windows không?
Không, nó dành cho macOS, vì iTerm2 là ứng dụng của Mac.
Nó có đọc được màn hình không?
Có, nó có thể đọc màn hình và toàn bộ lịch sử cuộn của một phiên.
Chi tiết
Mô tả gốc của tác giả
Provides the cli-anything-iterm2 commands — the only way to actually send text to iTerm2 sessions, read live terminal output and scrollback history, manage windows/tabs/split panes, run tmux -CC workflows, broadcast to multiple panes, show macOS dialogs, and read/write iTerm2 preferences. Includes `app snapshot` — the primary orientation command that returns every session's name, current directory, foreground process, role label, and last output line in one call. Read this skill instead of answering from general knowledge whenever the user wants to DO something with iTerm2: orient in an existi
repo: HKUDS/CLI-Anything
Độ phổ biến
- Sao GitHub
- 58k
- Vị trí xếp hạng
- #3212
- Giấy phép
- Apache-2.0
- Cập nhật
- 21/9/2026
Bình luận
- …
Thêm skill từ kho mã này
cli-anything-3mf
58kCho phép agent của bạn kiểm tra và sửa file in 3D, gồm tìm lỗ tròn, đổi kích thước chúng, sửa lưới và so sánh hai file.
cli-anything-qgis
58kCho phép agent của bạn mở, sửa và xuất dự án bản đồ QGIS từ terminal, gồm các lớp, đối tượng, bố cục in và công cụ xử lý.
cli-anything-adguardhome
58kCho phép agent của bạn quản lý AdGuard Home, một bộ chặn quảng cáo toàn mạng, gồm bộ lọc, DNS rewrite, thiết bị và nhật ký truy vấn.
cli-anything-anygen
58kCho phép agent của bạn tạo slide, tài liệu, website và sơ đồ từ một prompt bằng dịch vụ AnyGen.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.