refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Claude Code Authentication Status Checker
|
||||
# Checks both Claude Code and Clawdbot auth status
|
||||
# Checks both Claude Code and Moltbot auth status
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -17,7 +17,7 @@ NC='\033[0m' # No Color
|
||||
OUTPUT_MODE="${1:-full}"
|
||||
|
||||
fetch_models_status_json() {
|
||||
clawdbot models status --json 2>/dev/null || true
|
||||
moltbot models status --json 2>/dev/null || true
|
||||
}
|
||||
|
||||
STATUS_JSON="$(fetch_models_status_json)"
|
||||
@@ -103,7 +103,7 @@ check_claude_code_auth() {
|
||||
calc_status_from_expires "$expires_at"
|
||||
}
|
||||
|
||||
check_clawdbot_auth() {
|
||||
check_moltbot_auth() {
|
||||
if [ "$USE_JSON" -eq 1 ]; then
|
||||
local api_keys
|
||||
api_keys=$(json_anthropic_api_key_count)
|
||||
@@ -139,26 +139,26 @@ check_clawdbot_auth() {
|
||||
# JSON output mode
|
||||
if [ "$OUTPUT_MODE" = "json" ]; then
|
||||
claude_status=$(check_claude_code_auth 2>/dev/null || true)
|
||||
clawdbot_status=$(check_clawdbot_auth 2>/dev/null || true)
|
||||
moltbot_status=$(check_moltbot_auth 2>/dev/null || true)
|
||||
|
||||
claude_expires=0
|
||||
clawdbot_expires=0
|
||||
moltbot_expires=0
|
||||
if [ "$USE_JSON" -eq 1 ]; then
|
||||
claude_expires=$(json_expires_for_claude_cli)
|
||||
clawdbot_expires=$(json_expires_for_anthropic_any)
|
||||
moltbot_expires=$(json_expires_for_anthropic_any)
|
||||
else
|
||||
claude_expires=$(jq -r '.claudeAiOauth.expiresAt // 0' "$CLAUDE_CREDS" 2>/dev/null || echo "0")
|
||||
clawdbot_expires=$(jq -r '.profiles["anthropic:default"].expires // 0' "$CLAWDBOT_AUTH" 2>/dev/null || echo "0")
|
||||
moltbot_expires=$(jq -r '.profiles["anthropic:default"].expires // 0' "$CLAWDBOT_AUTH" 2>/dev/null || echo "0")
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg cs "$claude_status" \
|
||||
--arg ce "$claude_expires" \
|
||||
--arg bs "$clawdbot_status" \
|
||||
--arg be "$clawdbot_expires" \
|
||||
--arg bs "$moltbot_status" \
|
||||
--arg be "$moltbot_expires" \
|
||||
'{
|
||||
claude_code: {status: $cs, expires_at_ms: ($ce | tonumber)},
|
||||
clawdbot: {status: $bs, expires_at_ms: ($be | tonumber)},
|
||||
moltbot: {status: $bs, expires_at_ms: ($be | tonumber)},
|
||||
needs_reauth: (($cs | startswith("EXPIRED") or startswith("EXPIRING") or startswith("MISSING")) or ($bs | startswith("EXPIRED") or startswith("EXPIRING") or startswith("MISSING")))
|
||||
}'
|
||||
exit 0
|
||||
@@ -167,18 +167,18 @@ fi
|
||||
# Simple output mode (for scripts/widgets)
|
||||
if [ "$OUTPUT_MODE" = "simple" ]; then
|
||||
claude_status=$(check_claude_code_auth 2>/dev/null || true)
|
||||
clawdbot_status=$(check_clawdbot_auth 2>/dev/null || true)
|
||||
moltbot_status=$(check_moltbot_auth 2>/dev/null || true)
|
||||
|
||||
if [[ "$claude_status" == EXPIRED* ]] || [[ "$claude_status" == MISSING* ]]; then
|
||||
echo "CLAUDE_EXPIRED"
|
||||
exit 1
|
||||
elif [[ "$clawdbot_status" == EXPIRED* ]] || [[ "$clawdbot_status" == MISSING* ]]; then
|
||||
elif [[ "$moltbot_status" == EXPIRED* ]] || [[ "$moltbot_status" == MISSING* ]]; then
|
||||
echo "CLAWDBOT_EXPIRED"
|
||||
exit 1
|
||||
elif [[ "$claude_status" == EXPIRING* ]]; then
|
||||
echo "CLAUDE_EXPIRING"
|
||||
exit 2
|
||||
elif [[ "$clawdbot_status" == EXPIRING* ]]; then
|
||||
elif [[ "$moltbot_status" == EXPIRING* ]]; then
|
||||
echo "CLAWDBOT_EXPIRING"
|
||||
exit 2
|
||||
else
|
||||
@@ -228,7 +228,7 @@ else
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Clawdbot Auth (~/.clawdbot/agents/main/agent/auth-profiles.json):"
|
||||
echo "Moltbot Auth (~/.clawdbot/agents/main/agent/auth-profiles.json):"
|
||||
if [ "$USE_JSON" -eq 1 ]; then
|
||||
best_profile=$(json_best_anthropic_profile)
|
||||
expires=$(json_expires_for_anthropic_any)
|
||||
@@ -253,7 +253,7 @@ if [ "$expires" -le 0 ] && [ "$api_keys" -gt 0 ]; then
|
||||
echo -e " Status: ${GREEN}OK${NC} (API key)"
|
||||
elif [ "$expires" -le 0 ]; then
|
||||
echo -e " Status: ${RED}NOT FOUND${NC}"
|
||||
echo " Note: Run 'clawdbot doctor --yes' to sync from Claude Code"
|
||||
echo " Note: Run 'moltbot doctor --yes' to sync from Claude Code"
|
||||
else
|
||||
now_ms=$(( $(date +%s) * 1000 ))
|
||||
diff_ms=$((expires - now_ms))
|
||||
@@ -262,7 +262,7 @@ else
|
||||
|
||||
if [ "$diff_ms" -lt 0 ]; then
|
||||
echo -e " Status: ${RED}EXPIRED${NC}"
|
||||
echo " Note: Run 'clawdbot doctor --yes' to sync from Claude Code"
|
||||
echo " Note: Run 'moltbot doctor --yes' to sync from Claude Code"
|
||||
elif [ "$diff_ms" -lt 3600000 ]; then
|
||||
echo -e " Status: ${YELLOW}EXPIRING SOON (${mins}m remaining)${NC}"
|
||||
else
|
||||
@@ -273,8 +273,8 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "=== Service Status ==="
|
||||
if systemctl --user is-active clawdbot >/dev/null 2>&1; then
|
||||
echo -e "Clawdbot service: ${GREEN}running${NC}"
|
||||
if systemctl --user is-active moltbot >/dev/null 2>&1; then
|
||||
echo -e "Moltbot service: ${GREEN}running${NC}"
|
||||
else
|
||||
echo -e "Clawdbot service: ${RED}NOT running${NC}"
|
||||
echo -e "Moltbot service: ${RED}NOT running${NC}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user