forked from CodebuffAI/codebuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-cli-with-tmux.sh
More file actions
executable file
·59 lines (45 loc) · 1.35 KB
/
validate-cli-with-tmux.sh
File metadata and controls
executable file
·59 lines (45 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# Simple tmux-based CLI validation script
# Usage: ./cli/scripts/validate-cli-with-tmux.sh
set -e
SESSION_NAME="cli-validation-$(date +%s)"
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
# Check if tmux is available
if ! command -v tmux &> /dev/null; then
echo "❌ tmux not found"
echo ""
echo "📦 Installation:"
echo " macOS: brew install tmux"
echo " Ubuntu: sudo apt-get install tmux"
echo " Arch: sudo pacman -S tmux"
echo ""
exit 1
fi
# Create tmux session running CLI
tmux new-session -d -s "$SESSION_NAME" \
-x 120 -y 30 \
"cd $PROJECT_ROOT && bun --cwd=cli run dev 2>&1" 2>/dev/null
# Capture output at intervals
sleep 2
OUTPUT_2S=$(tmux capture-pane -t "$SESSION_NAME" -p 2>/dev/null)
sleep 3
OUTPUT_5S=$(tmux capture-pane -t "$SESSION_NAME" -p 2>/dev/null)
# Check for errors in output
if echo "$OUTPUT_5S" | grep -qi "error\|failed\|exception"; then
echo "❌ CLI validation detected errors:"
echo ""
echo "--- Output (2s) ---"
echo "$OUTPUT_2S"
echo "--- End Output ---"
echo ""
echo "--- Output (5s) ---"
echo "$OUTPUT_5S"
echo "--- End Output ---"
echo ""
tmux kill-session -t "$SESSION_NAME" 2>/dev/null || true
exit 1
fi
# Cleanup
tmux kill-session -t "$SESSION_NAME" 2>/dev/null || true
# Silent success
exit 0