diff --git a/automation/quick-status.sh b/automation/quick-status.sh new file mode 100755 index 0000000..475a4be --- /dev/null +++ b/automation/quick-status.sh @@ -0,0 +1,99 @@ +#!/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