mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-05 07:07:44 +00:00
feat: skills - inspect auto-tmux panes
This commit is contained in:
@@ -64,6 +64,7 @@ tmux list-panes -a -F '#S:#I.#P #{pane_current_command} #{pane_title}'
|
||||
|
||||
**读取指定 pane 最近输出**
|
||||
```bash
|
||||
skills/auto-tmux/scripts/auto-tmux.sh inspect -t <session>:<window>.<pane> -n 40
|
||||
skills/auto-tmux/scripts/auto-tmux.sh capture -t <session>:<window>.<pane> -n 120
|
||||
```
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ skills/auto-tmux/scripts/auto-tmux.sh topology --session ai-hub
|
||||
|
||||
```bash
|
||||
target="$(tmux list-panes -t ai-hub:worker1 -F '#S:#I.#P' | head -n 1)"
|
||||
skills/auto-tmux/scripts/auto-tmux.sh inspect -t "$target" -n 40
|
||||
skills/auto-tmux/scripts/auto-tmux.sh capture -t "$target" -n 120
|
||||
```
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|:---|:---|:---|
|
||||
| `doctor` | 检查 tmux、脚本、资产、session 健康状态 | 只读诊断 |
|
||||
| `topology` | 列出 session/window/pane 拓扑 | 只读 |
|
||||
| `inspect` | 输出单个 pane 元信息和最近输出 | 默认脱敏,只读 |
|
||||
| `capture` | 读取指定 pane 最近输出 | 默认脱敏,可保存到文件 |
|
||||
| `send` | 向指定 pane 发送文本或按键 | 先打印上下文,危险文本需 `--force` |
|
||||
| `broadcast` | 向指定 session 全部 pane 发送文本或按键 | 必须显式 session,支持 `--dry-run` |
|
||||
@@ -111,6 +112,7 @@ skills/auto-tmux/scripts/swarm-dispatch.sh --role worker --target "$target" --ta
|
||||
|
||||
```bash
|
||||
target="$(tmux list-panes -t ai-hub:worker1 -F '#S:#I.#P' | head -n 1)"
|
||||
skills/auto-tmux/scripts/auto-tmux.sh inspect -t "$target" -n 40
|
||||
skills/auto-tmux/scripts/auto-tmux.sh send -t "$target" --text "make test" --enter
|
||||
```
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ skills/auto-tmux/scripts/auto-tmux.sh doctor --session ai-hub
|
||||
target="$(tmux list-panes -t ai-hub:worker1 -F '#S:#I.#P' | head -n 1)"
|
||||
|
||||
# 读取指定 pane 最近 80 行
|
||||
skills/auto-tmux/scripts/auto-tmux.sh inspect -t "$target" -n 40
|
||||
skills/auto-tmux/scripts/auto-tmux.sh capture -t "$target" -n 80
|
||||
|
||||
# 发送命令并回车
|
||||
|
||||
@@ -44,6 +44,8 @@ commander_target="$(tmux list-panes -t "$SESSION:commander" -F '#S:#I.#P' | head
|
||||
worker_target="$(tmux list-panes -t "$SESSION:worker1" -F '#S:#I.#P' | head -n 1)"
|
||||
|
||||
"$AUTO_TMUX" capture -t "$commander_target" -n 10 >/tmp/auto-tmux-smoke-capture.txt
|
||||
"$AUTO_TMUX" inspect -t "$commander_target" -n 10 >/tmp/auto-tmux-smoke-inspect.txt
|
||||
grep -q 'pane inspect' /tmp/auto-tmux-smoke-inspect.txt
|
||||
"$AUTO_TMUX" broadcast --session "$SESSION" --text "pwd" --enter --dry-run >/tmp/auto-tmux-smoke-broadcast.txt
|
||||
"$AUTO_TMUX" send -t "$worker_target" --text "echo AUTO_TMUX_SMOKE_OK" --enter
|
||||
"$AUTO_TMUX" wait -t "$worker_target" --pattern "AUTO_TMUX_SMOKE_OK" --timeout 10 >/tmp/auto-tmux-smoke-wait.txt
|
||||
|
||||
@@ -15,6 +15,7 @@ Usage:
|
||||
auto-tmux.sh help
|
||||
auto-tmux.sh doctor [--session NAME]
|
||||
auto-tmux.sh topology [--session NAME]
|
||||
auto-tmux.sh inspect -t TARGET [-n LINES] [--no-redact]
|
||||
auto-tmux.sh capture -t TARGET [-n LINES] [--save FILE] [--no-redact]
|
||||
auto-tmux.sh send -t TARGET (--text TEXT | --key KEY) [--enter] [--clear] [--force] [--dry-run]
|
||||
auto-tmux.sh broadcast --session NAME (--text TEXT | --key KEY) [--enter] [--clear] [--force] [--dry-run]
|
||||
@@ -32,6 +33,7 @@ Target format:
|
||||
Examples:
|
||||
auto-tmux.sh doctor --session ai-hub
|
||||
auto-tmux.sh topology
|
||||
auto-tmux.sh inspect -t <target-from-topology> -n 40
|
||||
auto-tmux.sh capture -t <target-from-topology> -n 80
|
||||
auto-tmux.sh send -t <target-from-topology> --text "make test" --enter
|
||||
auto-tmux.sh broadcast --session ai-hub --text "pwd" --enter --dry-run
|
||||
@@ -209,6 +211,36 @@ cmd_topology() {
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_inspect() {
|
||||
local target=""
|
||||
local lines=40
|
||||
local no_redact="0"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-t|--target) target="${2:-}"; shift 2 ;;
|
||||
-n|--lines) lines="${2:-}"; shift 2 ;;
|
||||
--no-redact) no_redact="1"; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) die "unknown inspect option: $1" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
require_tmux
|
||||
require_target "$target"
|
||||
printf '# pane inspect\n\n'
|
||||
tmux display-message -pt "$target" 'target=#{session_name}:#{window_index}.#{pane_index}'
|
||||
tmux display-message -pt "$target" 'pane_id=#{pane_id}'
|
||||
tmux display-message -pt "$target" 'window=#{window_name}'
|
||||
tmux display-message -pt "$target" 'command=#{pane_current_command}'
|
||||
tmux display-message -pt "$target" 'pid=#{pane_pid}'
|
||||
tmux display-message -pt "$target" 'path=#{pane_current_path}'
|
||||
tmux display-message -pt "$target" 'title=#{pane_title}'
|
||||
tmux display-message -pt "$target" 'in_mode=#{pane_in_mode}'
|
||||
tmux display-message -pt "$target" 'size=#{pane_width}x#{pane_height}'
|
||||
printf '\n## recent output\n\n'
|
||||
capture_print "$target" "$lines" "$no_redact"
|
||||
}
|
||||
|
||||
cmd_broadcast() {
|
||||
local session=""
|
||||
local text=""
|
||||
@@ -584,6 +616,7 @@ main() {
|
||||
help|-h|--help) usage ;;
|
||||
doctor) cmd_doctor "$@" ;;
|
||||
topology) cmd_topology "$@" ;;
|
||||
inspect) cmd_inspect "$@" ;;
|
||||
capture) cmd_capture "$@" ;;
|
||||
send) cmd_send "$@" ;;
|
||||
broadcast) cmd_broadcast "$@" ;;
|
||||
|
||||
Reference in New Issue
Block a user