feat: skills - add auto-tmux report manifest

This commit is contained in:
tukuaiai
2026-05-19 14:00:02 +08:00
parent 33a4f01099
commit b46c412ec2
6 changed files with 50 additions and 5 deletions
+1
View File
@@ -15,6 +15,7 @@
- [`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 导出。
- 报告包根目录会生成 `index.md``manifest.json`,附件目录通过 `--attach` 显式加入。
- [`swarm-assign.sh`](./swarm-assign.sh) - 根据 ready tasks 和 worker pane 生成只读分配建议。
- [`swarm-health.sh`](./swarm-health.sh) - 汇总 doctor、topology、scan、validate、metrics、board 和 assign。
- [`remote-readonly.sh`](./remote-readonly.sh) - 通过 SSH 只读采集远端 tmux 拓扑、pane 输出和 `metadata.jsonl`
+41 -1
View File
@@ -23,11 +23,22 @@ die() {
exit 1
}
json_escape() {
local value="$1"
value="${value//\\/\\\\}"
value="${value//\"/\\\"}"
value="${value//$'\n'/\\n}"
value="${value//$'\r'/\\r}"
value="${value//$'\t'/\\t}"
printf '%s' "$value"
}
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)"
attachments=()
created_at="$(date -Is)"
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -83,6 +94,8 @@ else
fi
attachment_lines=""
attachment_json=""
attachment_count=0
if ((${#attachments[@]} > 0)); then
mkdir -p "$out_dir/attachments"
cat > "$out_dir/attachments.md" <<EOF
@@ -103,13 +116,39 @@ EOF
rel_path="attachments/$(basename "$dest")"
printf -- '- [%s](./%s)\n' "$attachment" "$rel_path" >> "$out_dir/attachments.md"
attachment_lines+="- [$rel_path](./$rel_path)"$'\n'
if ((attachment_count > 0)); then
attachment_json+=","$'\n'
fi
attachment_json+=" {\"source\":\"$(json_escape "$attachment")\",\"path\":\"$(json_escape "$rel_path")\"}"
attachment_count=$((attachment_count + 1))
done
fi
cat > "$out_dir/manifest.json" <<EOF
{
"type": "auto-tmux-swarm-report-pack",
"created_at": "$(json_escape "$created_at")",
"swarm_dir": "$(json_escape "$swarm_dir")",
"session": "$(json_escape "${session:-<not provided>}")",
"files": [
"index.md",
"board.md",
"deps.md",
"timeline.md",
"blockers.md",
"assign.md",
"export/manifest.json"
],
"attachments": [
$attachment_json
]
}
EOF
cat > "$out_dir/index.md" <<EOF
# auto-tmux Swarm Report Pack
- created_at: \`$(date -Is)\`
- created_at: \`$created_at\`
- swarm_dir: \`$swarm_dir\`
- session: \`${session:-<not provided>}\`
@@ -120,6 +159,7 @@ cat > "$out_dir/index.md" <<EOF
- [timeline.md](./timeline.md)
- [blockers.md](./blockers.md)
- [assign.md](./assign.md)
- [manifest.json](./manifest.json)
- [export/manifest.json](./export/manifest.json)
$(if [[ -n "$attachment_lines" ]]; then printf '%s' "- [attachments.md](./attachments.md)"; fi)
EOF
@@ -145,6 +145,9 @@ run_gate "swarm-report-pack attachment" bash -c '
printf "remote evidence\n" > "$tmp/remote/remote-tmux.txt"
"$1" --dir "$tmp/swarm" --out "$tmp/out" --attach "$tmp/remote" >/dev/null
grep -Fq "attachments.md" "$tmp/out/index.md"
grep -Fq "manifest.json" "$tmp/out/index.md"
grep -Fq "\"type\": \"auto-tmux-swarm-report-pack\"" "$tmp/out/manifest.json"
grep -Fq "\"attachments\"" "$tmp/out/manifest.json"
grep -Fq "remote-tmux.txt" "$tmp/out/attachments/remote/remote-tmux.txt"
rm -rf "$tmp"
' _ "$script_dir/swarm-report-pack.sh"