From 584c4dabb1b62503977c5d32631ac91dc574c32d Mon Sep 17 00:00:00 2001 From: zaksal58 Date: Sat, 7 Feb 2026 11:27:01 +0900 Subject: [PATCH] =?UTF-8?q?ccstatusline=20=EC=BB=A4=EC=8A=A4=ED=85=80=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B4=88=EA=B8=B0=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 3줄 레이아웃 (스타일/컨텍스트/비용 | 모델/세션 | 디렉토리/MCP/시계) - 이모지 라벨 + rawValue로 깔끔한 표시 - ctx-bar.sh: 컨텍스트 사용량 progress bar (█░ 스타일) - ctx-debug.sh: 디버그용 raw 데이터 출력 --- README.md | 39 +++++++++ ccstatusline/settings.json | 164 +++++++++++++++++++++++++++++++++++++ scripts/ctx-bar.sh | 34 ++++++++ scripts/ctx-debug.sh | 11 +++ 4 files changed, 248 insertions(+) create mode 100644 README.md create mode 100644 ccstatusline/settings.json create mode 100755 scripts/ctx-bar.sh create mode 100755 scripts/ctx-debug.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..31af658 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# ccstatusline-config + +Claude Code [ccstatusline](https://github.com/sirmalloc/ccstatusline) 커스텀 설정. + +## 구성 + +``` +ccstatusline/settings.json -- 위젯 배치/색상/이모지 설정 +scripts/ctx-bar.sh -- 컨텍스트 사용량 progress bar +scripts/ctx-debug.sh -- 디버그용 (컨텍스트 raw 데이터 출력) +``` + +## 상태바 레이아웃 + +``` +🎨 Explanatory | 🖥️ OY-Mac | 🧠 [████████░░░░] 70% | 💰 $4.10 +🤖 Opus 4.6 | 🔑 session-id +📁 /Users/zaksal58 | ⚡ MCP [ATL:O|SRN:O] | 🕐 11:15 +``` + +## 설치 (복원) + +```bash +# 1. ccstatusline 설정 복사 +cp ccstatusline/settings.json ~/.config/ccstatusline/settings.json + +# 2. 커스텀 스크립트 복사 +cp scripts/ctx-bar.sh ~/.claude/ctx-bar.sh +cp scripts/ctx-debug.sh ~/.claude/ctx-debug.sh +chmod +x ~/.claude/ctx-bar.sh ~/.claude/ctx-debug.sh + +# 3. ctx-bar.sh 경로 수정 (username이 다를 경우) +# settings.json 내 commandPath를 본인 경로로 변경 +``` + +## 요구사항 + +- [ccstatusline](https://github.com/sirmalloc/ccstatusline) (npx로 자동 실행) +- `jq` (context bar에 필요) diff --git a/ccstatusline/settings.json b/ccstatusline/settings.json new file mode 100644 index 0000000..7e03ae1 --- /dev/null +++ b/ccstatusline/settings.json @@ -0,0 +1,164 @@ +{ + "version": 3, + "lines": [ + [ + { + "id": "emoji-style-01", + "type": "custom-text", + "customText": "🎨 ", + "color": "brightBlue", + "merge": "no-padding" + }, + { + "id": "09db63c8-9edc-46b8-91b7-bf35066122f7", + "type": "output-style", + "color": "brightBlue", + "rawValue": true + }, + { + "id": "f2c932b4-57ab-46b3-8c24-074b8c4140f8", + "type": "separator" + }, + { + "id": "b6792028-c0b2-4209-b34e-ce3af7f5c237", + "type": "custom-text", + "customText": "🖥️ OY-Mac" + }, + { + "id": "3180e1fc-570f-4a4c-ab0b-fb913336bded", + "type": "separator" + }, + { + "id": "emoji-ctx-01", + "type": "custom-text", + "customText": "🧠 ", + "color": "brightGreen", + "merge": "no-padding" + }, + { + "id": "ctx-bar-widget", + "type": "custom-command", + "commandPath": "/Users/zaksal58/.claude/ctx-bar.sh", + "timeout": 2000, + "color": "brightGreen" + }, + { + "id": "a58c4447-5759-4888-b316-9f0043232852", + "type": "separator" + }, + { + "id": "emoji-cost-01", + "type": "custom-text", + "customText": "💰 ", + "color": "brightYellow", + "merge": "no-padding" + }, + { + "id": "3a91aef6-1daa-49ac-bb93-fdf8751dd6ff", + "type": "session-cost", + "color": "brightYellow", + "rawValue": true + } + ], + [ + { + "id": "emoji-model-01", + "type": "custom-text", + "customText": "🤖 ", + "color": "magenta", + "merge": "no-padding" + }, + { + "id": "4d88a67a-f243-4f73-9d85-875f875dd2e9", + "type": "model", + "color": "magenta", + "rawValue": true + }, + { + "id": "fa46829a-32a9-4703-9850-7e123e157ca9", + "type": "separator" + }, + { + "id": "emoji-session-01", + "type": "custom-text", + "customText": "🔑 ", + "color": "brightGreen", + "merge": "no-padding" + }, + { + "id": "1c7549b9-3e5b-4c4a-95ba-1a2dbabd0db6", + "type": "claude-session-id", + "color": "brightGreen", + "rawValue": true + } + ], + [ + { + "id": "emoji-dir-01", + "type": "custom-text", + "customText": "📁 ", + "color": "red", + "merge": "no-padding" + }, + { + "id": "3c6cd7cd-7b2c-46e3-8980-8893a59d8800", + "type": "current-working-dir", + "color": "red", + "rawValue": true + }, + { + "id": "fa826576-711a-44ac-bd15-3a6b1bf7b84a", + "type": "separator" + }, + { + "id": "emoji-mcp-01", + "type": "custom-text", + "customText": "⚡ ", + "color": "brightCyan", + "merge": "no-padding" + }, + { + "id": "b1a2c3d4-mcp-monitor-0002", + "type": "custom-command", + "commandPath": "a=$(podman ps --filter name=mcp-atlassian -q 2>/dev/null); s=$(lsof -i :8001 -sTCP:LISTEN -t 2>/dev/null); echo \"MCP [ATL:$([ -n \\\"$a\\\" ] && echo O || echo X)|SRN:$([ -n \\\"$s\\\" ] && echo O || echo X)]\"", + "timeout": 4000, + "color": "brightCyan" + }, + { + "id": "b1a2c3d4-clock-0001", + "type": "separator" + }, + { + "id": "emoji-clock-01", + "type": "custom-text", + "customText": "🕐 ", + "color": "gray", + "merge": "no-padding" + }, + { + "id": "b1a2c3d4-clock-0002", + "type": "custom-command", + "commandPath": "date '+%H:%M'", + "timeout": 1000, + "color": "gray" + } + ] + ], + "flexMode": "full-minus-40", + "compactThreshold": 60, + "colorLevel": 2, + "inheritSeparatorColors": false, + "globalBold": false, + "powerline": { + "enabled": false, + "separators": [ + "" + ], + "separatorInvertBackground": [ + false + ], + "startCaps": [], + "endCaps": [], + "autoAlign": false + } +} \ No newline at end of file diff --git a/scripts/ctx-bar.sh b/scripts/ctx-bar.sh new file mode 100755 index 0000000..95b1fad --- /dev/null +++ b/scripts/ctx-bar.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Context percentage progress bar for ccstatusline custom-command widget +# Receives Claude Code JSON via stdin + +input=$(cat) +if ! command -v jq >/dev/null 2>&1; then + echo "Ctx: ?" + exit 0 +fi + +# Extract context window info +CTX_SIZE=$(echo "$input" | jq -r '.context_window.context_window_size // 200000') +USAGE=$(echo "$input" | jq '.context_window.current_usage // null') + +if [ "$USAGE" = "null" ] || [ -z "$USAGE" ]; then + echo "Ctx: --" + exit 0 +fi + +CURRENT=$(echo "$USAGE" | jq '(.input_tokens // 0) + (.cache_creation_input_tokens // 0) + (.cache_read_input_tokens // 0)') + +# Usable = 80% of max (auto-compact threshold) +USABLE=$(( CTX_SIZE * 80 / 100 )) +USED_PCT=$(( CURRENT * 100 / USABLE )) +[ "$USED_PCT" -lt 0 ] && USED_PCT=0 +[ "$USED_PCT" -gt 100 ] && USED_PCT=100 + +# Build progress bar (width=12) - fills up as usage increases +W=12 +FILLED=$(( USED_PCT * W / 100 )) +EMPTY=$(( W - FILLED )) +BAR=$(printf '%*s' "$FILLED" '' | tr ' ' '█')$(printf '%*s' "$EMPTY" '' | tr ' ' '░') + +printf '%s %s%%' "[$BAR]" "$USED_PCT" diff --git a/scripts/ctx-debug.sh b/scripts/ctx-debug.sh new file mode 100755 index 0000000..faceabf --- /dev/null +++ b/scripts/ctx-debug.sh @@ -0,0 +1,11 @@ +#!/bin/bash +input=$(cat) +CTX_SIZE=$(echo "$input" | jq -r '.context_window.context_window_size // "N/A"') +USAGE=$(echo "$input" | jq '.context_window.current_usage // null') +INPUT_TOK=$(echo "$USAGE" | jq '.input_tokens // 0') +CACHE_CREATE=$(echo "$USAGE" | jq '.cache_creation_input_tokens // 0') +CACHE_READ=$(echo "$USAGE" | jq '.cache_read_input_tokens // 0') +CURRENT=$(( INPUT_TOK + CACHE_CREATE + CACHE_READ )) +USABLE=$(( CTX_SIZE * 80 / 100 )) +USED_PCT=$(( CURRENT * 100 / USABLE )) +echo "window=${CTX_SIZE} usable=${USABLE} current=${CURRENT} (in=${INPUT_TOK}+cc=${CACHE_CREATE}+cr=${CACHE_READ}) used=${USED_PCT}%"