-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto-dev.sh
More file actions
executable file
·53 lines (42 loc) · 1.67 KB
/
auto-dev.sh
File metadata and controls
executable file
·53 lines (42 loc) · 1.67 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
#!/bin/bash
# S.B. Continuous Development System
# 持续开发自动化脚本
set -e
PROJECT_DIR="/root/.openclaw/workspace/S.B."
LOG_FILE="$PROJECT_DIR/DEV_LOG.md"
PLAN_FILE="$PROJECT_DIR/DEVELOPMENT_PLAN.md"
cd "$PROJECT_DIR"
echo "========================================"
echo "S.B. Auto Dev Session - $(date '+%Y-%m-%d %H:%M:%S')"
echo "========================================"
# 1. 拉取最新代码
echo "📥 Pulling latest changes..."
git pull origin main 2>/dev/null || echo "No remote or already up to date"
# 2. 运行测试确保基线
echo "🧪 Running tests..."
npm test 2>&1 | tee /tmp/test-output.txt || true
TEST_STATUS=$?
if [ $TEST_STATUS -eq 0 ]; then
echo "✅ All tests passed"
else
echo "⚠️ Some tests failed, checking..."
fi
# 3. 获取当前任务
CURRENT_TASK=$(grep -A 1 "下一步" "$LOG_FILE" | tail -1 | sed 's/.*://' | xargs)
echo "🎯 Current Task: $CURRENT_TASK"
# 4. 检查 TypeScript 编译
echo "🔍 TypeScript check..."
npx tsc --noEmit 2>&1 | tee /tmp/tsc-output.txt || true
# 5. 记录状态到日志
echo "" >> "$LOG_FILE"
echo "### $(date '+%Y-%m-%d %H:%M')" >> "$LOG_FILE"
echo "**自动检查运行**" >> "$LOG_FILE"
echo "- 测试状态: $([ $TEST_STATUS -eq 0 ] && echo '通过' || echo '失败')" >> "$LOG_FILE"
echo "- 当前任务: $CURRENT_TASK" >> "$LOG_FILE"
echo "" >> "$LOG_FILE"
# 6. 提交开发日志
git add DEV_LOG.md DEVELOPMENT_PLAN.md 2>/dev/null || true
git commit -m "[Auto] Dev log update $(date '+%Y-%m-%d %H:%M')" 2>/dev/null || echo "No changes to commit"
echo "========================================"
echo "Session complete at $(date '+%Y-%m-%d %H:%M:%S')"
echo "========================================"