Files
claude-code/automation/quick-status.sh
OpenCode Test cbed85edf5 Add quick-status.sh automation script
Dashboard script for /status command that shows:
- System health (disk, memory, load, updates)
- Kubernetes status (nodes, pods)
- Email summary (unread count)
- Calendar overview

Features:
- Graceful handling of missing tools
- Health indicators (/⚠️/⏸️)
- Works in sandbox and full environments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 11:58:15 -08:00

100 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
# Quick status check across all domains
# Used by /status command
set -euo pipefail
CLAUDE_DIR="${HOME}/.claude"
echo "📊 Status Overview"
echo ""
# System check
echo "═══ System ═══"
echo -n "💻 Workstation: "
# Get disk usage for root
disk_pct=$(df / --output=pcent | tail -1 | tr -d ' %')
# Get memory usage
mem_info=$(free | grep Mem)
mem_total=$(echo "$mem_info" | awk '{print $2}')
mem_used=$(echo "$mem_info" | awk '{print $3}')
mem_pct=$((mem_used * 100 / mem_total))
# Get load
load=$(uptime | awk -F'load average:' '{print $2}' | awk -F',' '{print $1}' | tr -d ' ')
# Determine health
if [[ $disk_pct -gt 90 ]] || [[ $mem_pct -gt 90 ]]; then
echo "⚠️ Warning"
elif [[ $disk_pct -gt 80 ]] || [[ $mem_pct -gt 80 ]]; then
echo "⚡ Attention"
else
echo "✅ Healthy"
fi
echo " Disk: ${disk_pct}% used | Memory: ${mem_pct}% | Load: ${load}"
# Package updates (Arch Linux)
if command -v checkupdates &>/dev/null; then
updates=$(checkupdates 2>/dev/null | wc -l || echo "0")
updates=$(echo "$updates" | tr -d '[:space:]')
if [[ "$updates" =~ ^[0-9]+$ ]] && [[ $updates -gt 0 ]]; then
echo " Updates: ${updates} pending"
fi
fi
echo ""
# Kubernetes check (if kubectl available)
echo "═══ Kubernetes ═══"
if command -v kubectl &>/dev/null && kubectl cluster-info &>/dev/null 2>&1; then
echo -n "☸️ Cluster: "
# Node status
nodes_ready=$(kubectl get nodes --no-headers 2>/dev/null | grep -c " Ready" || echo "0")
nodes_total=$(kubectl get nodes --no-headers 2>/dev/null | wc -l || echo "0")
# Pod status
pods_running=$(kubectl get pods -A --no-headers 2>/dev/null | grep -c "Running" || echo "0")
# Determine health
if [[ $nodes_ready -eq $nodes_total ]] && [[ $nodes_total -gt 0 ]]; then
echo "✅ Healthy"
else
echo "⚠️ Issues"
fi
echo " Nodes: ${nodes_ready}/${nodes_total} Ready | Pods: ${pods_running} Running"
else
echo "☸️ Cluster: ⏸️ Not connected"
fi
echo ""
# Email check (if gmail scripts available)
echo "═══ Email ═══"
GMAIL_PY="${CLAUDE_DIR}/mcp/gmail/venv/bin/python"
if [[ -x "${GMAIL_PY}" ]]; then
# Quick unread count
unread_output=$($GMAIL_PY "${CLAUDE_DIR}/skills/gmail/scripts/check_unread.py" 1 50 2>/dev/null | head -1 || echo "")
if [[ -n "$unread_output" ]]; then
echo "📧 ${unread_output}"
else
echo "📧 Inbox: Unable to check"
fi
else
echo "📧 Inbox: ⏸️ Not configured"
fi
echo ""
# Calendar check (if gcal scripts available)
echo "═══ Calendar ═══"
if [[ -x "${GMAIL_PY}" ]]; then
cal_output=$($GMAIL_PY "${CLAUDE_DIR}/skills/gcal/scripts/agenda.py" today 2>/dev/null | head -5 || echo "")
if [[ -n "$cal_output" ]]; then
echo "$cal_output"
else
echo "📅 Calendar: Unable to check"
fi
else
echo "📅 Calendar: ⏸️ Not configured"
fi