Ver Fonte

feat(tool): 摸鱼脚本移除时间戳,内容随机化(短语池随机抽取拼接)

b há 5 dias atrás
pai
commit
482b0ed8b8
1 ficheiros alterados com 46 adições e 19 exclusões
  1. 46 19
      tool-moyu.sh

+ 46 - 19
tool-moyu.sh

@@ -43,32 +43,59 @@ while [ $# -gt 0 ]; do
 	esac
 done
 
-# 内置摸鱼内容(模拟一段 AI 工作汇报,可被文件参数覆盖)
-BUILTIN_CONTENT=$(cat <<'EOF'
-[13:00] Received request: set up CI/CD deployment pipeline
-[13:05] 🤖 Analyzing project structure, identifying Gogs repos and submodules
-[13:12] 🧠 Evaluating options: server resources tight, switch to local validation + SSH deploy
-[13:20] ✍️  Writing validate.sh / build.sh / deploy.sh scripts
-[13:35] ⚙️  Building deploy package locally, cross-compiling backend + frontend dist
-[13:48] 🔍 Fixing infinite restart caused by missing migrations directory
-[14:00] 📝 Writing aaPanel deployment guide, finalizing ports and domains
-[14:15] ✅ Local smoke test passed: MySQL 8.0 migration chain OK
-[14:30] 🚀 Deployed admin backend to test server, service active
-[14:40] 🌐 Frontend auto-deploy done, HTTP 200
-[14:50] 📊 Summarizing progress, updating backlog
-[15:00] 💬 Next: deploy backend-app, set up client/worker sites
-EOF
+# 内置随机内容池(摸鱼动作短语,运行时会随机抽取拼成“工作日志”)
+POOL=(
+	"🤖 Analyzing project structure..."
+	"🧠 Evaluating deployment strategies..."
+	"📊 Summarizing key decisions..."
+	"✍️  Generating execution summary..."
+	"🔍 Searching codebase knowledge graph..."
+	"⚙️  Refactoring module boundary..."
+	"📝 Drafting technical documentation..."
+	"✅ Running unit tests..."
+	"🔄 Syncing progress report..."
+	"💬 Preparing next action items..."
+	"🚀 Building release package..."
+	"🌐 Deploying frontend static assets..."
+	"🗄️  Migrating database schema..."
+	"🔐 Validating security configuration..."
+	"🧪 Executing smoke test..."
+	"📈 Analyzing performance bottlenecks..."
+	"🧩 Resolving dependency conflicts..."
+	"🛠️  Fixing cross-compilation issue..."
+	"📦 Packaging dist artifacts..."
+	"🖥️  Restarting backend service..."
+	"🔁 Iterating on review feedback..."
+	"📚 Updating API documentation..."
+	"🎯 Optimizing query performance..."
+	"🧹 Cleaning up dead code..."
+	"🔒 Hardening authentication flow..."
+	"🌍 Localizing UI strings..."
+	"⚡ Caching hot-path responses..."
+	"📋 Verifying requirements coverage..."
+	"🏗️  Scaffolding new module..."
+	"🔔 Sending build notification..."
 )
 
-# 内容来源:文件参数 > 内置内容
+# 随机生成一段“工作日志”(无时间戳,行数与内容每次不同)
+gen_random_content() {
+	local count=$((6 + RANDOM % 8))   # 6-13 行
+	LINES=()
+	local i
+	for ((i=0; i<count; i++)); do
+		LINES+=("${POOL[$((RANDOM % ${#POOL[@]}))]}")
+	done
+}
+
+# 内容来源:文件参数 > 随机生成
 CONTENT="${1:-}"
 if [ -n "$CONTENT" ] && [ -f "$CONTENT" ]; then
 	mapfile -t LINES < "$CONTENT"
 elif [ -n "$CONTENT" ] && [ "$CONTENT" != "-" ]; then
-	echo "File not found: $CONTENT, falling back to built-in content." >&2
-	mapfile -t LINES <<< "$BUILTIN_CONTENT"
+	echo "File not found: $CONTENT, falling back to random content." >&2
+	gen_random_content
 else
-	mapfile -t LINES <<< "$BUILTIN_CONTENT"
+	gen_random_content
 fi
 [ "${#LINES[@]}" -eq 0 ] && { echo "Content empty, nothing to slack on." >&2; exit 1; }