mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-25 16:48:28 +00:00
test: skills - add auto-tmux validation gate
This commit is contained in:
@@ -12,7 +12,8 @@ scripts/
|
||||
├── swarm-state.sh # 蜂群状态、任务、锁和报告管理
|
||||
├── swarm-brief.sh # 只读生成蜂群交接报告
|
||||
├── render-swarm-prompt.sh # commander/worker/reviewer 提示词渲染
|
||||
└── auto-tmux-smoke-test.sh # 临时 tmux 会话端到端自测
|
||||
├── auto-tmux-smoke-test.sh # 临时 tmux 会话端到端自测
|
||||
└── validate-auto-tmux.sh # auto-tmux 专属质量门禁
|
||||
```
|
||||
|
||||
## 维护规则
|
||||
@@ -26,4 +27,5 @@ scripts/
|
||||
- 交接报告脚本只读调用 doctor/topology/scan/report,不直接发送按键。
|
||||
- 状态脚本只能写入显式状态目录,不保存密钥、Token、密码或私密项目内容。
|
||||
- 自测脚本必须创建独立临时 tmux session,并在退出时清理。
|
||||
- 专属校验脚本必须覆盖脚本权限、语法、help 输出、关键索引、strict 校验和 smoke test。
|
||||
- 新增脚本后必须更新 `README.md`、`SKILL.md`、`references/index.md`,并运行 `bash -n` 与 skill strict 校验。
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
- [`swarm-brief.sh`](./swarm-brief.sh) - 只读生成蜂群交接报告,汇总 doctor、topology、pane 输出和状态报告。
|
||||
- [`render-swarm-prompt.sh`](./render-swarm-prompt.sh) - commander、worker、reviewer 提示词渲染。
|
||||
- [`auto-tmux-smoke-test.sh`](./auto-tmux-smoke-test.sh) - 创建临时 tmux 会话,端到端验证脚本能力。
|
||||
- [`validate-auto-tmux.sh`](./validate-auto-tmux.sh) - 汇总脚本权限、语法、help、文档索引、strict 和 smoke 门禁。
|
||||
|
||||
## 常用命令
|
||||
|
||||
@@ -53,6 +54,9 @@ skills/auto-tmux/scripts/swarm-state.sh report --dir /tmp/ai_swarm
|
||||
# 端到端自测
|
||||
skills/auto-tmux/scripts/auto-tmux-smoke-test.sh
|
||||
|
||||
# auto-tmux 专属质量门禁
|
||||
skills/auto-tmux/scripts/validate-auto-tmux.sh
|
||||
|
||||
# 渲染 worker prompt
|
||||
skills/auto-tmux/scripts/render-swarm-prompt.sh worker --target "$target" --task "只运行 make test"
|
||||
```
|
||||
|
||||
@@ -147,7 +147,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 auto-tmux-smoke-test.sh render-swarm-prompt.sh; do
|
||||
for script in auto-tmux.sh swarm-state.sh swarm-brief.sh render-swarm-prompt.sh auto-tmux-smoke-test.sh validate-auto-tmux.sh; do
|
||||
if [[ -x "$script_dir/$script" ]]; then
|
||||
status_line "OK" "script executable: $script"
|
||||
else
|
||||
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
#!/usr/bin/env bash
|
||||
# Validate the auto-tmux skill package with script, docs and optional smoke gates.
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
validate-auto-tmux: run auto-tmux package quality gates
|
||||
|
||||
Usage:
|
||||
validate-auto-tmux.sh [--no-smoke]
|
||||
|
||||
Checks:
|
||||
- required scripts exist and are executable
|
||||
- shell syntax is valid
|
||||
- help commands render without failure
|
||||
- SKILL.md and reference indexes mention the current script set
|
||||
- auto-skill strict validation passes
|
||||
- smoke test passes unless --no-smoke is used
|
||||
EOF
|
||||
}
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
skill_dir="$(cd "$script_dir/.." && pwd)"
|
||||
repo_root="$(git -C "$skill_dir" rev-parse --show-toplevel 2>/dev/null || true)"
|
||||
if [[ -z "$repo_root" ]]; then
|
||||
repo_root="$(cd "$skill_dir/../.." && pwd)"
|
||||
fi
|
||||
|
||||
run_smoke="1"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--no-smoke) run_smoke="0"; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) printf 'error: unknown option: %s\n' "$1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
failures=0
|
||||
|
||||
pass() {
|
||||
printf '[OK] %s\n' "$*"
|
||||
}
|
||||
|
||||
fail() {
|
||||
printf '[FAIL] %s\n' "$*" >&2
|
||||
failures=$((failures + 1))
|
||||
}
|
||||
|
||||
require_executable() {
|
||||
local path="$1"
|
||||
if [[ -x "$path" ]]; then
|
||||
pass "executable: ${path#$repo_root/}"
|
||||
else
|
||||
fail "missing or not executable: ${path#$repo_root/}"
|
||||
fi
|
||||
}
|
||||
|
||||
require_contains() {
|
||||
local file="$1"
|
||||
local pattern="$2"
|
||||
if grep -Fq "$pattern" "$file"; then
|
||||
pass "$(basename "$file") mentions $pattern"
|
||||
else
|
||||
fail "$(basename "$file") missing $pattern"
|
||||
fi
|
||||
}
|
||||
|
||||
run_gate() {
|
||||
local name="$1"
|
||||
shift
|
||||
if "$@" >/tmp/auto-tmux-validate-gate.log 2>&1; then
|
||||
pass "$name"
|
||||
else
|
||||
fail "$name"
|
||||
sed -n '1,80p' /tmp/auto-tmux-validate-gate.log >&2
|
||||
fi
|
||||
}
|
||||
|
||||
scripts=(
|
||||
"$script_dir/auto-tmux.sh"
|
||||
"$script_dir/swarm-state.sh"
|
||||
"$script_dir/swarm-brief.sh"
|
||||
"$script_dir/render-swarm-prompt.sh"
|
||||
"$script_dir/auto-tmux-smoke-test.sh"
|
||||
)
|
||||
|
||||
for script in "${scripts[@]}"; do
|
||||
require_executable "$script"
|
||||
run_gate "bash syntax: ${script##*/}" bash -n "$script"
|
||||
done
|
||||
|
||||
run_gate "auto-tmux help" "$script_dir/auto-tmux.sh" help
|
||||
run_gate "swarm-state help" "$script_dir/swarm-state.sh" help
|
||||
run_gate "swarm-brief help" "$script_dir/swarm-brief.sh" --help
|
||||
run_gate "render-swarm-prompt help" "$script_dir/render-swarm-prompt.sh" --help
|
||||
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/validate-auto-tmux.sh"
|
||||
require_contains "$skill_dir/SKILL.md" "scripts/swarm-brief.sh"
|
||||
require_contains "$skill_dir/references/index.md" "automation.md"
|
||||
require_contains "$skill_dir/references/README.md" "swarm-state.md"
|
||||
require_contains "$script_dir/README.md" "validate-auto-tmux.sh"
|
||||
require_contains "$script_dir/AGENTS.md" "validate-auto-tmux.sh"
|
||||
|
||||
if [[ -x "$repo_root/skills/auto-skill/scripts/validate-skill.sh" ]]; then
|
||||
run_gate "auto-skill strict validation" "$repo_root/skills/auto-skill/scripts/validate-skill.sh" "$skill_dir" --strict
|
||||
else
|
||||
fail "auto-skill validator not found"
|
||||
fi
|
||||
|
||||
if [[ "$run_smoke" == "1" ]]; then
|
||||
run_gate "auto-tmux smoke test" "$script_dir/auto-tmux-smoke-test.sh"
|
||||
else
|
||||
pass "smoke test skipped by --no-smoke"
|
||||
fi
|
||||
|
||||
rm -f /tmp/auto-tmux-validate-gate.log
|
||||
|
||||
if (( failures > 0 )); then
|
||||
printf 'auto-tmux validation failed: %s issue(s)\n' "$failures" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'auto-tmux validation ok\n'
|
||||
Reference in New Issue
Block a user