QwenClaw v2.0 - Complete Rebuild with ALL 81+ Skills
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "statusline-tools",
|
||||
"version": "1.0.1",
|
||||
"description": "Cross-platform statusline showing session context, cost, and account-wide 5H usage with time until reset.",
|
||||
"author": {
|
||||
"name": "Fatih Akyon"
|
||||
},
|
||||
"homepage": "https://github.com/fcakyon/claude-codex-settings#plugins",
|
||||
"repository": "https://github.com/fcakyon/claude-codex-settings",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
---
|
||||
description: Configure Claude Code statusline
|
||||
---
|
||||
|
||||
# Statusline Setup
|
||||
|
||||
Configure the Claude Code statusline to display session context, cost, and account-wide usage.
|
||||
|
||||
## Step 1: Check Current Status
|
||||
|
||||
Read `~/.claude/settings.json` and `.claude/settings.local.json` to check if `statusLine` is configured.
|
||||
|
||||
Report:
|
||||
|
||||
- "Statusline configured in user settings: [command]" if found in ~/.claude/settings.json
|
||||
- "Statusline configured in project settings: [command]" if found in .claude/settings.local.json
|
||||
- "Statusline is not configured" if neither exists
|
||||
|
||||
## Step 2: Show Options
|
||||
|
||||
Tell the user:
|
||||
|
||||
```
|
||||
Statusline Options:
|
||||
|
||||
1. Native (recommended for Claude subscription/API)
|
||||
- Shows: [Session] context% $cost | [5H] usage% time-until-reset
|
||||
- Account-wide 5H usage tracking with time until reset
|
||||
- Color-coded: green <50%, yellow 50-80%, red >80%
|
||||
- Requires: Claude subscription (Max/Pro) or Claude API key
|
||||
- Does NOT work with: z.ai, third-party endpoints
|
||||
|
||||
2. ccusage (for external endpoints)
|
||||
- Shows: context%, session/daily cost
|
||||
- Works with: Anthropic, z.ai, third-party endpoints
|
||||
- Limitation: No account-wide 5H block usage info
|
||||
|
||||
3. Disable - Remove statusline
|
||||
```
|
||||
|
||||
## Step 3: Ask for Choice
|
||||
|
||||
Use AskUserQuestion:
|
||||
|
||||
- question: "Which statusline do you want?"
|
||||
- header: "Statusline"
|
||||
- options:
|
||||
- label: "Native (Claude subscription/API)"
|
||||
description: "Session + account-wide 5H usage with reset time"
|
||||
- label: "ccusage (external endpoints)"
|
||||
description: "Works with z.ai - no 5H block info"
|
||||
- label: "Disable"
|
||||
description: "Remove statusline"
|
||||
|
||||
## Step 4: If Native Selected
|
||||
|
||||
### Ask where to install
|
||||
|
||||
Use AskUserQuestion:
|
||||
|
||||
- question: "Where should the statusline be configured?"
|
||||
- header: "Location"
|
||||
- options:
|
||||
- label: "User settings (global)"
|
||||
description: "~/.claude/settings.json - applies to all projects"
|
||||
- label: "Project local"
|
||||
description: ".claude/settings.local.json - this project only"
|
||||
|
||||
### Check for existing config
|
||||
|
||||
If statusLine already exists in chosen location, use AskUserQuestion:
|
||||
|
||||
- question: "Statusline already configured. Replace it?"
|
||||
- header: "Override"
|
||||
- options:
|
||||
- label: "Yes, replace"
|
||||
description: "Override existing statusline config"
|
||||
- label: "No, cancel"
|
||||
description: "Keep current config"
|
||||
|
||||
If user chooses "No, cancel", stop and say "Setup cancelled."
|
||||
|
||||
### Install Native
|
||||
|
||||
1. Read `${CLAUDE_PLUGIN_ROOT}/scripts/statusline.sh`
|
||||
2. Write to `~/.claude/statusline.sh`
|
||||
3. Run `chmod +x ~/.claude/statusline.sh`
|
||||
4. Read current settings file (user or project based on choice)
|
||||
5. Create backup with `.backup` suffix
|
||||
6. Add/update `statusLine`:
|
||||
|
||||
```json
|
||||
"statusLine": {
|
||||
"type": "command",
|
||||
"command": "~/.claude/statusline.sh",
|
||||
"padding": 0
|
||||
}
|
||||
```
|
||||
|
||||
7. Write back to settings file
|
||||
|
||||
## Step 5: If ccusage Selected
|
||||
|
||||
### Ask where to install
|
||||
|
||||
Use AskUserQuestion:
|
||||
|
||||
- question: "Where should the statusline be configured?"
|
||||
- header: "Location"
|
||||
- options:
|
||||
- label: "User settings (global)"
|
||||
description: "~/.claude/settings.json - applies to all projects"
|
||||
- label: "Project local"
|
||||
description: ".claude/settings.local.json - this project only"
|
||||
|
||||
### Check for existing config and confirm override (same as Native)
|
||||
|
||||
### Install ccusage
|
||||
|
||||
1. Read current settings file
|
||||
2. Create backup with `.backup` suffix
|
||||
3. Add/update `statusLine`:
|
||||
|
||||
```json
|
||||
"statusLine": {
|
||||
"type": "command",
|
||||
"command": "npx -y ccusage@latest statusline --cost-source cc",
|
||||
"padding": 0
|
||||
}
|
||||
```
|
||||
|
||||
4. Write back to settings file
|
||||
|
||||
## Step 6: If Disable Selected
|
||||
|
||||
1. Read `~/.claude/settings.json`
|
||||
2. Create backup
|
||||
3. Remove `statusLine` key if exists
|
||||
4. Write back
|
||||
|
||||
Also check `.claude/settings.local.json` and remove `statusLine` if present.
|
||||
|
||||
## Step 7: Confirm Success
|
||||
|
||||
Tell the user:
|
||||
|
||||
```
|
||||
Statusline configured successfully!
|
||||
|
||||
IMPORTANT: Restart Claude Code for changes to take effect.
|
||||
- Exit Claude Code (Ctrl+C or /exit)
|
||||
- Run `claude` again
|
||||
|
||||
Backup saved to [settings-file].backup
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
Native statusline requires `jq`. Check with `which jq`.
|
||||
|
||||
If jq not installed:
|
||||
|
||||
- macOS: `brew install jq`
|
||||
- Ubuntu/Debian: `sudo apt install jq`
|
||||
- Other: https://jqlang.org/download/
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
# Cross-platform statusline (no jq)
|
||||
|
||||
RST='\033[0m' WHITE='\033[97m' DIM='\033[2m'
|
||||
GREEN='\033[32m' YELLOW='\033[33m' RED='\033[31m'
|
||||
|
||||
json_num() { echo "$2" | sed -n 's/.*"'"$1"'"[[:space:]]*:[[:space:]]*\([0-9.]*\).*/\1/p' | head -1; }
|
||||
color_pct() { [ "$1" -lt 50 ] && echo "$GREEN" || { [ "$1" -lt 70 ] && echo "$YELLOW" || echo "$RED"; }; }
|
||||
color_time() { [ "$1" -lt 3600 ] && echo "$GREEN" || { [ "$1" -lt 12600 ] && echo "$YELLOW" || echo "$RED"; }; }
|
||||
|
||||
# Session stats from stdin
|
||||
input=$(cat)
|
||||
CTX_SIZE=$(json_num context_window_size "$input")
|
||||
CTX_SIZE=${CTX_SIZE:-200000}
|
||||
COST=$(json_num total_cost_usd "$input")
|
||||
COST=${COST:-0}
|
||||
INPUT_T=$(json_num input_tokens "$input")
|
||||
INPUT_T=${INPUT_T:-0}
|
||||
CACHE_C=$(json_num cache_creation_input_tokens "$input")
|
||||
CACHE_C=${CACHE_C:-0}
|
||||
CACHE_R=$(json_num cache_read_input_tokens "$input")
|
||||
CACHE_R=${CACHE_R:-0}
|
||||
|
||||
CURRENT=$((INPUT_T + CACHE_C + CACHE_R))
|
||||
CTX_PCT=$((CTX_SIZE > 0 ? CURRENT * 100 / CTX_SIZE : 0))
|
||||
COST_INT=$(LC_NUMERIC=C printf "%.0f" "${COST:-0}" 2> /dev/null || echo 0)
|
||||
|
||||
# Account usage from API (cached 30s)
|
||||
CACHE_FILE="/tmp/claude-usage-cache.json"
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
AGE=$(($(date +%s) - $(stat -f %m "$CACHE_FILE" 2> /dev/null || echo 0)))
|
||||
else
|
||||
AGE=$(($(date +%s) - $(stat -c %Y "$CACHE_FILE" 2> /dev/null || echo 0)))
|
||||
fi
|
||||
|
||||
API=""
|
||||
[ -f "$CACHE_FILE" ] && [ "$AGE" -lt 30 ] && API=$(cat "$CACHE_FILE")
|
||||
|
||||
if [ -z "$API" ]; then
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
CREDS=$(security find-generic-password -s "Claude Code-credentials" -w 2> /dev/null)
|
||||
elif [ -f "$HOME/.claude/.credentials.json" ]; then
|
||||
CREDS=$(cat "$HOME/.claude/.credentials.json")
|
||||
fi
|
||||
TOKEN=$(echo "$CREDS" | sed -n 's/.*"claudeAiOauth"[^}]*"accessToken"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)
|
||||
if [ -n "$TOKEN" ]; then
|
||||
API=$(curl -s "https://api.anthropic.com/api/oauth/usage" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "anthropic-beta: oauth-2025-04-20" \
|
||||
-H "User-Agent: claude-code/2.0.76")
|
||||
echo "$API" > "$CACHE_FILE" 2> /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
ACCT_PCT=$(echo "$API" | sed -n 's/.*"five_hour"[^}]*"utilization"[[:space:]]*:[[:space:]]*\([0-9.]*\).*/\1/p' | head -1)
|
||||
ACCT_PCT=${ACCT_PCT%.*}
|
||||
ACCT_PCT=${ACCT_PCT:-0}
|
||||
RESET_AT=$(echo "$API" | sed -n 's/.*"five_hour"[^}]*"resets_at"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)
|
||||
|
||||
TIME_STR="?" SECS=0
|
||||
if [ -n "$RESET_AT" ]; then
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
RESET_EPOCH=$(TZ=UTC date -j -f "%Y-%m-%dT%H:%M:%S" "${RESET_AT:0:19}" +%s 2> /dev/null || echo 0)
|
||||
else
|
||||
RESET_EPOCH=$(date -u -d "${RESET_AT:0:19}" +%s 2> /dev/null || echo 0)
|
||||
fi
|
||||
SECS=$((RESET_EPOCH - $(date +%s)))
|
||||
[ "$SECS" -lt 0 ] && SECS=0
|
||||
TIME_STR="$((SECS / 3600))h$(((SECS % 3600) / 60))m"
|
||||
fi
|
||||
|
||||
printf "${DIM}[Session]${RST} $(color_pct $CTX_PCT)%d%%${RST} ${WHITE}\$%d${RST} ${DIM}|${RST} ${DIM}[5H]${RST} $(color_pct $ACCT_PCT)%d%%${RST} $(color_time $SECS)%s${RST}" "$CTX_PCT" "$COST_INT" "$ACCT_PCT" "$TIME_STR"
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
name: setup
|
||||
description: This skill should be used when user asks to "configure statusline", "setup statusline", "show context usage", "display token count", "5H usage", "time until reset", "statusline colors", "statusline not working", or wants to change how the Claude Code status bar displays information.
|
||||
---
|
||||
|
||||
# Statusline Setup
|
||||
|
||||
Run `/statusline-tools:setup` to configure the Claude Code statusline.
|
||||
|
||||
## Options
|
||||
|
||||
- **Native (session + 5H usage)** - Anthropic API only, color-coded display
|
||||
- **ccusage (session/daily stats)** - Works with z.ai too
|
||||
- **Disable** - Remove statusline display
|
||||
|
||||
## What Native Statusline Shows
|
||||
|
||||
`[Session] 45% $3 | [5H] 16% 3h52m`
|
||||
|
||||
**Displayed information:**
|
||||
|
||||
- Session context window usage percentage
|
||||
- Session cost in USD
|
||||
- Account-wide 5-hour usage percentage
|
||||
- Time until 5H block resets
|
||||
|
||||
**Color scheme:**
|
||||
|
||||
- 🟢 <50% usage or <1h until reset
|
||||
- 🟡 50-70% usage or 1-3.5h until reset
|
||||
- 🔴 70%+ usage or >3.5h until reset
|
||||
|
||||
**Note:** Native may not work with z.ai/third-party endpoints. Use ccusage for z.ai.
|
||||
|
||||
## Requirements
|
||||
|
||||
Native statusline requires `jq` and `curl`. Install:
|
||||
|
||||
- macOS: `brew install jq`
|
||||
- Ubuntu/Debian: `sudo apt install jq`
|
||||
|
||||
## Docs
|
||||
|
||||
[Claude Code statusline docs](https://code.claude.com/docs/en/statusline) for more details.
|
||||
Reference in New Issue
Block a user