mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-22 07:18:05 +00:00
feat: skills - render auto-tmux swarm timeline
This commit is contained in:
@@ -16,6 +16,7 @@ scripts/
|
||||
├── swarm-board.sh # 从 swarm state 渲染 Markdown 看板
|
||||
├── swarm-deps-graph.sh # 从 deps.tsv 渲染 Mermaid 依赖图
|
||||
├── swarm-export.sh # 导出 JSONL 状态包
|
||||
├── swarm-timeline.sh # 从 status.log 渲染 Markdown 时间线
|
||||
├── swarm-assign.sh # 生成 ready task 到 worker pane 的分配建议
|
||||
├── swarm-health.sh # 汇总只读健康检查报告包
|
||||
├── record-summary.sh # 汇总 pipe-pane 录制日志
|
||||
@@ -42,6 +43,7 @@ scripts/
|
||||
- 看板脚本只读 `tasks.tsv`、`deps.tsv`、锁和状态日志,不改写状态目录。
|
||||
- 依赖图脚本只读 `tasks.tsv` 和 `deps.tsv`,不改写状态目录。
|
||||
- 导出脚本只读 `tasks.tsv`、`deps.tsv` 和锁目录,只写显式输出目录。
|
||||
- 时间线脚本只读 `status.log`,不改写状态目录。
|
||||
- 分配建议脚本只读任务和 pane 拓扑,不 claim 任务、不发送 prompt。
|
||||
- 健康检查脚本只读 tmux 与 swarm state,失败项写入报告,不做自动修复。
|
||||
- 录制摘要脚本只读 record 日志,输出默认脱敏,不修改日志源文件。
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
- [`swarm-board.sh`](./swarm-board.sh) - 将 `tasks.tsv`、依赖、锁和状态日志渲染为 Markdown 看板。
|
||||
- [`swarm-deps-graph.sh`](./swarm-deps-graph.sh) - 将 `deps.tsv` 渲染为 Mermaid 依赖图。
|
||||
- [`swarm-export.sh`](./swarm-export.sh) - 将任务、依赖和锁导出为 JSONL 包。
|
||||
- [`swarm-timeline.sh`](./swarm-timeline.sh) - 将 `status.log` 渲染为 Markdown 时间线。
|
||||
- [`swarm-assign.sh`](./swarm-assign.sh) - 根据 ready tasks 和 worker pane 生成只读分配建议。
|
||||
- [`swarm-health.sh`](./swarm-health.sh) - 汇总 doctor、topology、scan、validate、metrics、board 和 assign。
|
||||
- [`record-summary.sh`](./record-summary.sh) - 汇总 `record start` 产生的 pane 日志,生成复盘摘要。
|
||||
@@ -74,6 +75,9 @@ skills/auto-tmux/scripts/swarm-deps-graph.sh --dir /tmp/ai_swarm --out /tmp/ai-s
|
||||
# 导出机器可读状态包
|
||||
skills/auto-tmux/scripts/swarm-export.sh --dir /tmp/ai_swarm --out /tmp/ai-swarm-export
|
||||
|
||||
# 生成状态时间线
|
||||
skills/auto-tmux/scripts/swarm-timeline.sh --dir /tmp/ai_swarm --out /tmp/ai-swarm-timeline.md
|
||||
|
||||
# 生成 worker 分配建议
|
||||
skills/auto-tmux/scripts/swarm-assign.sh --swarm-dir /tmp/ai_swarm --session ai-hub --out /tmp/ai-swarm-assign.md
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ SWARM_ARCHIVE="$SCRIPT_DIR/swarm-archive.sh"
|
||||
SWARM_BOARD="$SCRIPT_DIR/swarm-board.sh"
|
||||
SWARM_DEPS_GRAPH="$SCRIPT_DIR/swarm-deps-graph.sh"
|
||||
SWARM_EXPORT="$SCRIPT_DIR/swarm-export.sh"
|
||||
SWARM_TIMELINE="$SCRIPT_DIR/swarm-timeline.sh"
|
||||
SWARM_ASSIGN="$SCRIPT_DIR/swarm-assign.sh"
|
||||
SWARM_HEALTH="$SCRIPT_DIR/swarm-health.sh"
|
||||
RECORD_SUMMARY="$SCRIPT_DIR/record-summary.sh"
|
||||
@@ -30,6 +31,7 @@ ARCHIVE_FILE="/tmp/auto-tmux-smoke-archive-$$.tar.gz"
|
||||
BOARD_FILE="/tmp/auto-tmux-smoke-board-$$.md"
|
||||
DEPS_GRAPH_FILE="/tmp/auto-tmux-smoke-deps-graph-$$.md"
|
||||
EXPORT_DIR="/tmp/auto-tmux-smoke-export-$$"
|
||||
TIMELINE_FILE="/tmp/auto-tmux-smoke-timeline-$$.md"
|
||||
ASSIGN_FILE="/tmp/auto-tmux-smoke-assign-$$.md"
|
||||
HEALTH_DIR="/tmp/auto-tmux-smoke-health-$$"
|
||||
DISPATCH_PROMPT="/tmp/auto-tmux-smoke-dispatch-$$.md"
|
||||
@@ -38,7 +40,7 @@ PASTE_FILE="/tmp/auto-tmux-smoke-paste-$$.txt"
|
||||
|
||||
cleanup() {
|
||||
tmux kill-session -t "$SESSION" 2>/dev/null || true
|
||||
rm -rf "$SWARM_DIR" "$DEP_SWARM_DIR" "$SNAPSHOT_DIR" "$RECORD_DIR" "$RECORD_SUMMARY_FILE" "$BRIEF_DIR" "$WATCH_DIR" "$ARCHIVE_FILE" "$BOARD_FILE" "$DEPS_GRAPH_FILE" "$EXPORT_DIR" "$ASSIGN_FILE" "$HEALTH_DIR" "$DISPATCH_PROMPT" "$TASK_IMPORT_FILE" "$PASTE_FILE"
|
||||
rm -rf "$SWARM_DIR" "$DEP_SWARM_DIR" "$SNAPSHOT_DIR" "$RECORD_DIR" "$RECORD_SUMMARY_FILE" "$BRIEF_DIR" "$WATCH_DIR" "$ARCHIVE_FILE" "$BOARD_FILE" "$DEPS_GRAPH_FILE" "$EXPORT_DIR" "$TIMELINE_FILE" "$ASSIGN_FILE" "$HEALTH_DIR" "$DISPATCH_PROMPT" "$TASK_IMPORT_FILE" "$PASTE_FILE"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
@@ -56,6 +58,7 @@ bash -n "$SWARM_ARCHIVE"
|
||||
bash -n "$SWARM_BOARD"
|
||||
bash -n "$SWARM_DEPS_GRAPH"
|
||||
bash -n "$SWARM_EXPORT"
|
||||
bash -n "$SWARM_TIMELINE"
|
||||
bash -n "$SWARM_ASSIGN"
|
||||
bash -n "$SWARM_HEALTH"
|
||||
bash -n "$RECORD_SUMMARY"
|
||||
@@ -161,6 +164,9 @@ grep -q 'task_dep_a --> task_dep_b' "$DEPS_GRAPH_FILE"
|
||||
grep -q '"type":"auto-tmux-swarm-export"' "$EXPORT_DIR/manifest.json"
|
||||
grep -q '"id":"smoke-task"' "$EXPORT_DIR/tasks.jsonl"
|
||||
grep -q '"task_id":"dep-b"' "$EXPORT_DIR/deps.jsonl"
|
||||
"$SWARM_TIMELINE" --dir "$SWARM_DIR" --out "$TIMELINE_FILE" -n 50 >/tmp/auto-tmux-smoke-timeline.txt
|
||||
grep -q 'auto-tmux Swarm Timeline' "$TIMELINE_FILE"
|
||||
grep -q 'DONE' "$TIMELINE_FILE"
|
||||
"$SWARM_ASSIGN" --swarm-dir "$SWARM_DIR" --session "$SESSION" --out "$ASSIGN_FILE" --limit 20 >/tmp/auto-tmux-smoke-assign.txt
|
||||
grep -q 'auto-tmux Swarm Assignment Suggestions' "$ASSIGN_FILE"
|
||||
grep -q 'swarm-dispatch.sh' "$ASSIGN_FILE"
|
||||
|
||||
@@ -153,7 +153,7 @@ cmd_doctor() {
|
||||
status_line "WARN" "tmux server has no reachable session yet"
|
||||
fi
|
||||
|
||||
for script in auto-tmux.sh swarm-state.sh swarm-brief.sh swarm-watch.sh swarm-archive.sh swarm-board.sh swarm-deps-graph.sh swarm-export.sh swarm-assign.sh swarm-health.sh record-summary.sh safety-check.sh render-swarm-prompt.sh swarm-dispatch.sh auto-tmux-smoke-test.sh validate-auto-tmux.sh; do
|
||||
for script in auto-tmux.sh swarm-state.sh swarm-brief.sh swarm-watch.sh swarm-archive.sh swarm-board.sh swarm-deps-graph.sh swarm-export.sh swarm-timeline.sh swarm-assign.sh swarm-health.sh record-summary.sh safety-check.sh render-swarm-prompt.sh swarm-dispatch.sh auto-tmux-smoke-test.sh validate-auto-tmux.sh; do
|
||||
if [[ -x "$script_dir/$script" ]]; then
|
||||
status_line "OK" "script executable: $script"
|
||||
else
|
||||
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env bash
|
||||
# swarm-timeline: render swarm status.log as a Markdown timeline.
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
swarm-timeline: render auto-tmux status.log as Markdown
|
||||
|
||||
Usage:
|
||||
swarm-timeline.sh [--dir DIR] [--out FILE] [-n LINES]
|
||||
|
||||
Defaults:
|
||||
--dir AUTO_TMUX_SWARM_DIR or /tmp/ai_swarm
|
||||
--out stdout
|
||||
-n 100 recent status lines
|
||||
|
||||
This script is read-only. It does not mutate swarm state.
|
||||
EOF
|
||||
}
|
||||
|
||||
die() {
|
||||
printf 'error: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
swarm_dir="${AUTO_TMUX_SWARM_DIR:-/tmp/ai_swarm}"
|
||||
out_file=""
|
||||
lines=100
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--dir|--swarm-dir)
|
||||
swarm_dir="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--out)
|
||||
out_file="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-n|--lines)
|
||||
lines="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
die "unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[[ "$lines" =~ ^[0-9]+$ ]] || die "--lines must be a number"
|
||||
status_log="$swarm_dir/status.log"
|
||||
[[ -f "$status_log" ]] || die "status log not found: $status_log"
|
||||
|
||||
render_timeline() {
|
||||
printf '# auto-tmux Swarm Timeline\n\n'
|
||||
printf -- '- dir: `%s`\n' "$swarm_dir"
|
||||
printf -- '- created_at: `%s`\n' "$(date -Is)"
|
||||
printf -- '- lines: `%s`\n\n' "$lines"
|
||||
|
||||
printf '## Summary\n\n'
|
||||
printf '| status | count |\n'
|
||||
printf '|:---|---:|\n'
|
||||
tail -n "$lines" "$status_log" |
|
||||
awk -F '[][]' '
|
||||
NF >= 6 {count[$6]++}
|
||||
END {
|
||||
if (length(count) == 0) {
|
||||
print "| - | 0 |"
|
||||
} else {
|
||||
for (status in count) print "| `" status "` | " count[status] " |"
|
||||
}
|
||||
}
|
||||
' | sort
|
||||
|
||||
printf '\n## Timeline\n\n'
|
||||
tail -n "$lines" "$status_log" |
|
||||
awk -F '[][]' '
|
||||
function esc(value) {
|
||||
gsub(/\|/, "\\|", value)
|
||||
return value
|
||||
}
|
||||
NF >= 6 {
|
||||
message = $7
|
||||
sub(/^ /, "", message)
|
||||
print "- `" $2 "` `" esc($4) "` **" esc($6) "** " esc(message)
|
||||
next
|
||||
}
|
||||
{print "- " esc($0)}
|
||||
'
|
||||
}
|
||||
|
||||
if [[ -n "$out_file" ]]; then
|
||||
mkdir -p "$(dirname "$out_file")"
|
||||
render_timeline > "$out_file"
|
||||
printf 'swarm timeline written: %s\n' "$out_file"
|
||||
else
|
||||
render_timeline
|
||||
fi
|
||||
@@ -85,6 +85,7 @@ scripts=(
|
||||
"$script_dir/swarm-board.sh"
|
||||
"$script_dir/swarm-deps-graph.sh"
|
||||
"$script_dir/swarm-export.sh"
|
||||
"$script_dir/swarm-timeline.sh"
|
||||
"$script_dir/swarm-assign.sh"
|
||||
"$script_dir/swarm-health.sh"
|
||||
"$script_dir/record-summary.sh"
|
||||
@@ -110,6 +111,7 @@ run_gate "swarm-archive help" "$script_dir/swarm-archive.sh" --help
|
||||
run_gate "swarm-board help" "$script_dir/swarm-board.sh" --help
|
||||
run_gate "swarm-deps-graph help" "$script_dir/swarm-deps-graph.sh" --help
|
||||
run_gate "swarm-export help" "$script_dir/swarm-export.sh" --help
|
||||
run_gate "swarm-timeline help" "$script_dir/swarm-timeline.sh" --help
|
||||
run_gate "swarm-assign help" "$script_dir/swarm-assign.sh" --help
|
||||
run_gate "swarm-health help" "$script_dir/swarm-health.sh" --help
|
||||
run_gate "record-summary help" "$script_dir/record-summary.sh" --help
|
||||
@@ -130,6 +132,7 @@ require_contains "$skill_dir/SKILL.md" "scripts/swarm-archive.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-board.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-deps-graph.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-export.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-timeline.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-assign.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-health.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/record-summary.sh"
|
||||
@@ -147,6 +150,7 @@ require_contains "$script_dir/README.md" "swarm-archive.sh"
|
||||
require_contains "$script_dir/README.md" "swarm-board.sh"
|
||||
require_contains "$script_dir/README.md" "swarm-deps-graph.sh"
|
||||
require_contains "$script_dir/README.md" "swarm-export.sh"
|
||||
require_contains "$script_dir/README.md" "swarm-timeline.sh"
|
||||
require_contains "$script_dir/README.md" "swarm-assign.sh"
|
||||
require_contains "$script_dir/README.md" "swarm-health.sh"
|
||||
require_contains "$script_dir/README.md" "record-summary.sh"
|
||||
@@ -159,6 +163,7 @@ require_contains "$script_dir/AGENTS.md" "swarm-archive.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "swarm-board.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "swarm-deps-graph.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "swarm-export.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "swarm-timeline.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "swarm-assign.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "swarm-health.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "record-summary.sh"
|
||||
|
||||
Reference in New Issue
Block a user