|
|
@@ -43,73 +43,86 @@ while [ $# -gt 0 ]; do
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
-# 内置随机内容池:混搭 AI 动作、bash 命令与输出、工具调用返回(本会话就地取材)
|
|
|
-POOL=(
|
|
|
- # ---- AI 动作(少量图标) ----
|
|
|
- "🤖 analyzing dependency graph..."
|
|
|
- "📊 summarizing key decisions..."
|
|
|
- "✍️ drafting implementation plan..."
|
|
|
- "🔍 tracing call chain..."
|
|
|
- "🔒 reviewing security config..."
|
|
|
- "💬 preparing next steps..."
|
|
|
-
|
|
|
- # ---- bash 命令 ----
|
|
|
- "$ make tt a=/workspace/shell-kit"
|
|
|
- "$ go vet ./..."
|
|
|
- "$ go test ./..."
|
|
|
- "$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o admin_server ./cmd/server"
|
|
|
- "$ pnpm typecheck"
|
|
|
- "$ pnpm build"
|
|
|
- "$ rsync -az --delete release/frontend/ root@18.220.34.224:/www/wwwroot/household/"
|
|
|
- "$ ssh -p 10022 root@18.220.34.224 'systemctl restart backend-admin'"
|
|
|
- "$ mysql -h127.0.0.1 -uhousehold -p**** household -e 'SHOW TABLES;'"
|
|
|
- "$ curl -s -o /dev/null -w 'HTTP %{http_code}\\n' http://127.0.0.1:8081/"
|
|
|
- "$ journalctl -u backend-admin -n 30 --no-pager"
|
|
|
- "$ git log --oneline -5"
|
|
|
- "$ docker compose ps"
|
|
|
- "$ systemctl status backend-app"
|
|
|
- "$ cat internal/config/config.yaml"
|
|
|
-
|
|
|
- # ---- bash 输出 ----
|
|
|
+# ---- 命令与对应输出(成对,命令后紧跟其输出更真实) ----
|
|
|
+COMMANDS=(
|
|
|
+ "go vet ./..."
|
|
|
+ "go test ./..."
|
|
|
+ "CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o admin_server ./cmd/server"
|
|
|
+ "pnpm typecheck"
|
|
|
+ "pnpm build"
|
|
|
+ "rsync -az --delete release/frontend/ root@18.220.34.224:/www/wwwroot/household/"
|
|
|
+ "ssh -p 10022 root@18.220.34.224 'systemctl restart backend-admin'"
|
|
|
+ "mysql -h127.0.0.1 -uhousehold -p**** household -e 'SHOW TABLES;'"
|
|
|
+ "curl -s -o /dev/null -w 'HTTP %{http_code}\\n' http://127.0.0.1:8081/"
|
|
|
+ "journalctl -u backend-admin -n 30 --no-pager"
|
|
|
+ "systemctl status backend-app"
|
|
|
+ "git log --oneline -5"
|
|
|
+)
|
|
|
+COMMAND_OUT=(
|
|
|
+ "ok 0.231s"
|
|
|
"ok git.ooo.ink/household/app 0.532s"
|
|
|
- "ok matrix/center 0.410s"
|
|
|
- "PASS"
|
|
|
+ "[build] release/backend/admin/admin_server (ELF, linux/amd64)"
|
|
|
+ "no type errors found"
|
|
|
"✓ built in 26.39s"
|
|
|
- "✓ 307 modules transformed."
|
|
|
- "vite v7.3.6 building client environment for production..."
|
|
|
- "dist/assets/index-*.js 95.77 kB │ gzip: 37.38 kB"
|
|
|
- "[GIN-debug] Listening and serving HTTP on :8081"
|
|
|
- "migrations completed successfully"
|
|
|
+ "sent 2.4MB, 1.1MB/s"
|
|
|
"systemd[1]: Started backend-admin.service - Household Backend Admin."
|
|
|
- "Active: active (running)"
|
|
|
+ "Tables: center_admins center_menus center_roles ... (19 total)"
|
|
|
"HTTP 200"
|
|
|
- "mysql_native_password"
|
|
|
- "Tables_in_household: center_admins center_menus center_roles ..."
|
|
|
- "schema_migrations: 20260828001 | dirty=0"
|
|
|
- "ready for connections. Version: '8.0.46' socket: '/var/run/mysqld/mysqld.sock' port: 3306"
|
|
|
+ "[GIN-debug] Listening and serving HTTP on :8081"
|
|
|
+ "Active: active (running)"
|
|
|
+ "f37eec3 docs(deploy): 后端目录对齐测试机实际路径"
|
|
|
+)
|
|
|
|
|
|
- # ---- 工具调用返回 ----
|
|
|
+# ---- 独立行(工具调用返回 / 日志 / 少量 AI 动作) ----
|
|
|
+STANDALONE=(
|
|
|
"[read] docs/deploy-aaPanel.md 168 lines"
|
|
|
- "[search] "migrations" → 3 results"
|
|
|
+ "[search] migrations → 3 results"
|
|
|
"[trace] RunMigrations → internal/pkg/database.RunMigrations"
|
|
|
"[snippet] buildDSN → user:pass@tcp(host:port)/db?parseTime=True"
|
|
|
- "[build] release/backend/admin/admin_server (ELF, linux/amd64)"
|
|
|
"[deploy] backend-admin → active"
|
|
|
"[deploy] frontend-admin → HTTP 200"
|
|
|
"[check] SSH root@18.220.34.224:10022 → ok"
|
|
|
"[verify] curl admin.household.ooo.ink → 200 OK"
|
|
|
"[skip] no changes, up to date"
|
|
|
- "[warn] config.yaml contains placeholder secret, leaving as-is on server"
|
|
|
+ "[warn] config.yaml placeholder secret left as-is on server"
|
|
|
+ "ready for connections. socket: '/var/run/mysqld/mysqld.sock' port: 3306"
|
|
|
+ "schema_migrations: 20260828001 | dirty=0"
|
|
|
+ "dist/assets/index-*.js 95.77 kB │ gzip: 37.38 kB"
|
|
|
+ "vite v7.3.6 building client environment for production..."
|
|
|
+ "🤖 analyzing dependency graph..."
|
|
|
+ "📊 summarizing key decisions..."
|
|
|
+ "✍️ drafting implementation plan..."
|
|
|
+ "🔒 reviewing security config..."
|
|
|
)
|
|
|
|
|
|
-# 随机生成一段“工作日志”(无时间戳,行数与内容每次不同)
|
|
|
+# 返回 $1 个不重复随机下标(0..$2-1)
|
|
|
+pick_unique() {
|
|
|
+ local count=$1 pool=$2
|
|
|
+ [ "$pool" -lt "$count" ] && count=$pool
|
|
|
+ seq 0 $((pool-1)) | sort -R | head -n "$count"
|
|
|
+}
|
|
|
+
|
|
|
+# 随机生成一段“工作日志”:命令对 + 独立行,洗牌打乱,尽量不重复
|
|
|
+# 同一次运行内命令对与独立行均不重复,避免“重复模式”
|
|
|
gen_random_content() {
|
|
|
- local count=$((9 + RANDOM % 10)) # 9-18 行
|
|
|
+ local cmdc=$((2 + RANDOM % 3)) # 2-4 对命令
|
|
|
+ local stc=$((3 + RANDOM % 4)) # 3-6 独立行
|
|
|
+ local ci si i
|
|
|
LINES=()
|
|
|
- local i
|
|
|
- for ((i=0; i<count; i++)); do
|
|
|
- LINES+=("${POOL[$((RANDOM % ${#POOL[@]}))]}")
|
|
|
+ # 命令对(不重复抽取),命令后紧跟其输出
|
|
|
+ for ci in $(pick_unique "$cmdc" "${#COMMANDS[@]}"); do
|
|
|
+ LINES+=("\$ ${COMMANDS[$ci]}")
|
|
|
+ LINES+=("${COMMAND_OUT[$ci]}")
|
|
|
+ done
|
|
|
+ # 独立行(不重复抽取)
|
|
|
+ for si in $(pick_unique "$stc" "${#STANDALONE[@]}"); do
|
|
|
+ LINES+=("${STANDALONE[$si]}")
|
|
|
done
|
|
|
+ # 洗牌打乱整体顺序,避免命令总是集中在一处
|
|
|
+ local idx=($(seq 0 $((${#LINES[@]}-1)) | sort -R))
|
|
|
+ local shuffled=()
|
|
|
+ for i in "${idx[@]}"; do shuffled+=("${LINES[$i]}"); done
|
|
|
+ LINES=("${shuffled[@]}")
|
|
|
}
|
|
|
|
|
|
# 内容来源:文件参数 > 随机生成
|