mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-18 13:28:11 +00:00
feat: skills - build auto-tmux swarm report packs
This commit is contained in:
@@ -18,6 +18,7 @@ scripts/
|
||||
├── swarm-export.sh # 导出 JSONL 状态包
|
||||
├── swarm-timeline.sh # 从 status.log 渲染 Markdown 时间线
|
||||
├── swarm-blockers.sh # 聚合 BLOCKED/FAIL、锁和异常状态
|
||||
├── swarm-report-pack.sh # 聚合只读报告包
|
||||
├── swarm-assign.sh # 生成 ready task 到 worker pane 的分配建议
|
||||
├── swarm-health.sh # 汇总只读健康检查报告包
|
||||
├── record-summary.sh # 汇总 pipe-pane 录制日志
|
||||
@@ -46,6 +47,7 @@ scripts/
|
||||
- 导出脚本只读 `tasks.tsv`、`deps.tsv` 和锁目录,只写显式输出目录。
|
||||
- 时间线脚本只读 `status.log`,不改写状态目录。
|
||||
- 阻塞报告脚本只读任务、锁和状态日志,不做自动修复。
|
||||
- 报告包脚本只编排只读脚本并写入显式输出目录,不 claim 任务、不发送 prompt。
|
||||
- 分配建议脚本只读任务和 pane 拓扑,不 claim 任务、不发送 prompt。
|
||||
- 健康检查脚本只读 tmux 与 swarm state,失败项写入报告,不做自动修复。
|
||||
- 录制摘要脚本只读 record 日志,输出默认脱敏,不修改日志源文件。
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
- [`swarm-export.sh`](./swarm-export.sh) - 将任务、依赖和锁导出为 JSONL 包。
|
||||
- [`swarm-timeline.sh`](./swarm-timeline.sh) - 将 `status.log` 渲染为 Markdown 时间线。
|
||||
- [`swarm-blockers.sh`](./swarm-blockers.sh) - 聚合 BLOCKED/FAIL 任务、锁和最近异常状态。
|
||||
- [`swarm-report-pack.sh`](./swarm-report-pack.sh) - 聚合 board、依赖图、时间线、阻塞清单、分配建议和 JSONL 导出。
|
||||
- [`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 日志,生成复盘摘要。
|
||||
@@ -82,6 +83,9 @@ skills/auto-tmux/scripts/swarm-timeline.sh --dir /tmp/ai_swarm --out /tmp/ai-swa
|
||||
# 生成阻塞清单
|
||||
skills/auto-tmux/scripts/swarm-blockers.sh --dir /tmp/ai_swarm --out /tmp/ai-swarm-blockers.md
|
||||
|
||||
# 生成完整报告包
|
||||
skills/auto-tmux/scripts/swarm-report-pack.sh --dir /tmp/ai_swarm --session ai-hub --out /tmp/ai-swarm-report-pack
|
||||
|
||||
# 生成 worker 分配建议
|
||||
skills/auto-tmux/scripts/swarm-assign.sh --swarm-dir /tmp/ai_swarm --session ai-hub --out /tmp/ai-swarm-assign.md
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ SWARM_DEPS_GRAPH="$SCRIPT_DIR/swarm-deps-graph.sh"
|
||||
SWARM_EXPORT="$SCRIPT_DIR/swarm-export.sh"
|
||||
SWARM_TIMELINE="$SCRIPT_DIR/swarm-timeline.sh"
|
||||
SWARM_BLOCKERS="$SCRIPT_DIR/swarm-blockers.sh"
|
||||
SWARM_REPORT_PACK="$SCRIPT_DIR/swarm-report-pack.sh"
|
||||
SWARM_ASSIGN="$SCRIPT_DIR/swarm-assign.sh"
|
||||
SWARM_HEALTH="$SCRIPT_DIR/swarm-health.sh"
|
||||
RECORD_SUMMARY="$SCRIPT_DIR/record-summary.sh"
|
||||
@@ -34,6 +35,7 @@ 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"
|
||||
BLOCKERS_FILE="/tmp/auto-tmux-smoke-blockers-$$.md"
|
||||
REPORT_PACK_DIR="/tmp/auto-tmux-smoke-report-pack-$$"
|
||||
ASSIGN_FILE="/tmp/auto-tmux-smoke-assign-$$.md"
|
||||
HEALTH_DIR="/tmp/auto-tmux-smoke-health-$$"
|
||||
DISPATCH_PROMPT="/tmp/auto-tmux-smoke-dispatch-$$.md"
|
||||
@@ -42,7 +44,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" "$TIMELINE_FILE" "$BLOCKERS_FILE" "$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" "$BLOCKERS_FILE" "$REPORT_PACK_DIR" "$ASSIGN_FILE" "$HEALTH_DIR" "$DISPATCH_PROMPT" "$TASK_IMPORT_FILE" "$PASTE_FILE"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
@@ -62,6 +64,7 @@ bash -n "$SWARM_DEPS_GRAPH"
|
||||
bash -n "$SWARM_EXPORT"
|
||||
bash -n "$SWARM_TIMELINE"
|
||||
bash -n "$SWARM_BLOCKERS"
|
||||
bash -n "$SWARM_REPORT_PACK"
|
||||
bash -n "$SWARM_ASSIGN"
|
||||
bash -n "$SWARM_HEALTH"
|
||||
bash -n "$RECORD_SUMMARY"
|
||||
@@ -173,6 +176,10 @@ grep -q 'DONE' "$TIMELINE_FILE"
|
||||
"$SWARM_BLOCKERS" --dir "$SWARM_DIR" --out "$BLOCKERS_FILE" -n 50 >/tmp/auto-tmux-smoke-blockers.txt
|
||||
grep -q 'auto-tmux Swarm Blockers' "$BLOCKERS_FILE"
|
||||
grep -q 'smoke-fail' "$BLOCKERS_FILE"
|
||||
"$SWARM_REPORT_PACK" --dir "$SWARM_DIR" --session "$SESSION" --out "$REPORT_PACK_DIR" >/tmp/auto-tmux-smoke-report-pack.txt
|
||||
grep -q 'auto-tmux Swarm Report Pack' "$REPORT_PACK_DIR/index.md"
|
||||
test -s "$REPORT_PACK_DIR/board.md"
|
||||
test -s "$REPORT_PACK_DIR/export/tasks.jsonl"
|
||||
"$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-timeline.sh swarm-blockers.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-blockers.sh swarm-report-pack.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
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
# swarm-report-pack: build a portable read-only report pack for swarm state.
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
swarm-report-pack: build an auto-tmux swarm report pack
|
||||
|
||||
Usage:
|
||||
swarm-report-pack.sh [--dir DIR] [--session NAME] [--out DIR]
|
||||
|
||||
Defaults:
|
||||
--dir AUTO_TMUX_SWARM_DIR or /tmp/ai_swarm
|
||||
--out /tmp/auto-tmux-report-pack-YYYYmmdd-HHMMSS
|
||||
|
||||
This script is read-only for tmux and swarm state. It writes only to --out.
|
||||
EOF
|
||||
}
|
||||
|
||||
die() {
|
||||
printf 'error: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
swarm_dir="${AUTO_TMUX_SWARM_DIR:-/tmp/ai_swarm}"
|
||||
session=""
|
||||
out_dir="/tmp/auto-tmux-report-pack-$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--dir|--swarm-dir)
|
||||
swarm_dir="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--session)
|
||||
session="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--out)
|
||||
out_dir="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
die "unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
mkdir -p "$out_dir/export"
|
||||
|
||||
run_report() {
|
||||
local label="$1"
|
||||
shift
|
||||
if "$@" >/tmp/auto-tmux-report-pack.log 2>&1; then
|
||||
printf '[OK] %s\n' "$label"
|
||||
else
|
||||
printf '[WARN] %s failed\n' "$label" >&2
|
||||
sed -n '1,80p' /tmp/auto-tmux-report-pack.log >&2
|
||||
fi
|
||||
}
|
||||
|
||||
run_report "board" "$script_dir/swarm-board.sh" --dir "$swarm_dir" --out "$out_dir/board.md"
|
||||
run_report "dependency graph" "$script_dir/swarm-deps-graph.sh" --dir "$swarm_dir" --out "$out_dir/deps.md"
|
||||
run_report "timeline" "$script_dir/swarm-timeline.sh" --dir "$swarm_dir" --out "$out_dir/timeline.md"
|
||||
run_report "blockers" "$script_dir/swarm-blockers.sh" --dir "$swarm_dir" --out "$out_dir/blockers.md"
|
||||
run_report "export" "$script_dir/swarm-export.sh" --dir "$swarm_dir" --out "$out_dir/export"
|
||||
|
||||
if [[ -n "$session" ]]; then
|
||||
run_report "assign" "$script_dir/swarm-assign.sh" --swarm-dir "$swarm_dir" --session "$session" --out "$out_dir/assign.md"
|
||||
else
|
||||
run_report "assign" "$script_dir/swarm-assign.sh" --swarm-dir "$swarm_dir" --out "$out_dir/assign.md"
|
||||
fi
|
||||
|
||||
cat > "$out_dir/index.md" <<EOF
|
||||
# auto-tmux Swarm Report Pack
|
||||
|
||||
- created_at: \`$(date -Is)\`
|
||||
- swarm_dir: \`$swarm_dir\`
|
||||
- session: \`${session:-<not provided>}\`
|
||||
|
||||
## Files
|
||||
|
||||
- [board.md](./board.md)
|
||||
- [deps.md](./deps.md)
|
||||
- [timeline.md](./timeline.md)
|
||||
- [blockers.md](./blockers.md)
|
||||
- [assign.md](./assign.md)
|
||||
- [export/manifest.json](./export/manifest.json)
|
||||
EOF
|
||||
|
||||
rm -f /tmp/auto-tmux-report-pack.log
|
||||
printf 'swarm report pack written: %s\n' "$out_dir"
|
||||
@@ -87,6 +87,7 @@ scripts=(
|
||||
"$script_dir/swarm-export.sh"
|
||||
"$script_dir/swarm-timeline.sh"
|
||||
"$script_dir/swarm-blockers.sh"
|
||||
"$script_dir/swarm-report-pack.sh"
|
||||
"$script_dir/swarm-assign.sh"
|
||||
"$script_dir/swarm-health.sh"
|
||||
"$script_dir/record-summary.sh"
|
||||
@@ -114,6 +115,7 @@ 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-blockers help" "$script_dir/swarm-blockers.sh" --help
|
||||
run_gate "swarm-report-pack help" "$script_dir/swarm-report-pack.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
|
||||
@@ -136,6 +138,7 @@ 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-blockers.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-report-pack.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"
|
||||
@@ -155,6 +158,7 @@ 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-blockers.sh"
|
||||
require_contains "$script_dir/README.md" "swarm-report-pack.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"
|
||||
@@ -169,6 +173,7 @@ 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-blockers.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "swarm-report-pack.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