MATTERMOST_OPENCLAW_LIVESTATUS/install.sh
2026-02-23 17:14:33 +00:00

70 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# OpenClaw Live Status Installer (Wizard Mode)
echo "=========================================="
echo " OpenClaw Live Status Tool - Installer "
echo "=========================================="
# 1. Install Binary
echo "[+] Installing binary to /usr/local/bin/live-status..."
cp src/live-status.js /usr/local/bin/live-status
chmod +x /usr/local/bin/live-status
# 2. Install Skill
echo "[+] Installing skill to /app/skills/live-status..."
mkdir -p /app/skills/live-status
cp skill/SKILL.md /app/skills/live-status/SKILL.md
# 3. Global Agent Configuration (Injection)
echo "[+] Configuring global agent defaults..."
AGENTS_FILE="/home/node/.openclaw/workspace/AGENTS.md"
if [ -f "$AGENTS_FILE" ]; then
if grep -q "Live Status Protocol" "$AGENTS_FILE"; then
echo " > AGENTS.md already configured."
else
echo " > Injecting mandatory protocol into AGENTS.md..."
cat >> "$AGENTS_FILE" <<EOF
## 📡 Live Status Protocol (MANDATORY)
**For ANY multi-step task (e.g., research, downloading, installing, compiling):**
1. **Read Skill:** Load \`/app/skills/live-status/SKILL.md\`.
2. **Initialize:** Run \`live-status create\` with a code block (\`[STATUS] INITIALIZING...\`).
3. **Capture ID:** Store the Post ID returned by \`create\`.
4. **Update:** Frequently run \`live-status update <ID>\` to stream progress.
5. **Complete:** Mark as \`[COMPLETED]\` when done.
**Why:** This provides "Antigravity-style" visibility without spamming channels. Sub-agents MUST use this tool instead of \`message\` for progress reports.
EOF
fi
else
echo " > Warning: AGENTS.md not found. Skipping injection."
fi
# 4. Mattermost Configuration (Wizard)
echo ""
echo "[?] Mattermost Configuration Check:"
# Check if the installed tool still has the default placeholder
if grep -q "DEFAULT_TOKEN_PLACEHOLDER" /usr/local/bin/live-status; then
echo " > Default token detected."
read -p " > Enter your Mattermost Bot Token: " NEW_TOKEN
if [[ -n "$NEW_TOKEN" ]]; then
# Replace the placeholder in the INSTALLED binary (not the source)
sed -i "s/DEFAULT_TOKEN_PLACEHOLDER/$NEW_TOKEN/g" /usr/local/bin/live-status
echo " > Token configured successfully."
else
echo " > No token entered. Tool may not function."
fi
else
echo " > Custom token already configured."
fi
echo ""
echo "=========================================="
echo " Installation Complete!"
echo "=========================================="
echo "Usage: live-status create \"...\""