claude-skill-lord 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.commitlintrc.json +27 -0
- package/.env.example +26 -0
- package/.releaserc.json +119 -0
- package/.repomixignore +22 -0
- package/CLAUDE.md +15 -1
- package/README.md +35 -19
- package/docs/code-standards.md +949 -0
- package/hooks/hooks.json +6 -0
- package/package.json +6 -2
- package/scripts/statusline.js +263 -0
- package/scripts/statusline.ps1 +312 -0
- package/scripts/statusline.sh +141 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Generated by cc-statusline (https://www.npmjs.com/package/@chongdashu/cc-statusline)
|
|
3
|
+
# Custom Claude Code statusline - Created: 2025-08-19T05:45:09.773Z
|
|
4
|
+
# Theme: detailed | Colors: true | Features: directory, git, model, usage, session, tokens
|
|
5
|
+
|
|
6
|
+
input=$(cat)
|
|
7
|
+
|
|
8
|
+
# ---- color helpers (TTY-aware, respect NO_COLOR) ----
|
|
9
|
+
use_color=1
|
|
10
|
+
[ -t 1 ] || use_color=0
|
|
11
|
+
[ -n "$NO_COLOR" ] && use_color=0
|
|
12
|
+
|
|
13
|
+
C() { if [ "$use_color" -eq 1 ]; then printf '\033[%sm' "$1"; fi; }
|
|
14
|
+
RST() { if [ "$use_color" -eq 1 ]; then printf '\033[0m'; fi; }
|
|
15
|
+
|
|
16
|
+
# ---- basic colors ----
|
|
17
|
+
dir_color() { if [ "$use_color" -eq 1 ]; then printf '\033[1;36m'; fi; } # cyan
|
|
18
|
+
model_color() { if [ "$use_color" -eq 1 ]; then printf '\033[1;35m'; fi; } # magenta
|
|
19
|
+
version_color() { if [ "$use_color" -eq 1 ]; then printf '\033[1;33m'; fi; } # yellow
|
|
20
|
+
rst() { if [ "$use_color" -eq 1 ]; then printf '\033[0m'; fi; }
|
|
21
|
+
|
|
22
|
+
# ---- time helpers ----
|
|
23
|
+
to_epoch() {
|
|
24
|
+
ts="$1"
|
|
25
|
+
if command -v gdate >/dev/null 2>&1; then gdate -d "$ts" +%s 2>/dev/null && return; fi
|
|
26
|
+
date -u -j -f "%Y-%m-%dT%H:%M:%S%z" "${ts/Z/+0000}" +%s 2>/dev/null && return
|
|
27
|
+
python3 - "$ts" <<'PY' 2>/dev/null
|
|
28
|
+
import sys, datetime
|
|
29
|
+
s=sys.argv[1].replace('Z','+00:00')
|
|
30
|
+
print(int(datetime.datetime.fromisoformat(s).timestamp()))
|
|
31
|
+
PY
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fmt_time_hm() {
|
|
35
|
+
epoch="$1"
|
|
36
|
+
if date -r 0 +%s >/dev/null 2>&1; then date -r "$epoch" +"%H:%M"; else date -d "@$epoch" +"%H:%M"; fi
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
progress_bar() {
|
|
40
|
+
pct="${1:-0}"; width="${2:-10}"
|
|
41
|
+
[[ "$pct" =~ ^[0-9]+$ ]] || pct=0; ((pct<0))&&pct=0; ((pct>100))&&pct=100
|
|
42
|
+
filled=$(( pct * width / 100 )); empty=$(( width - filled ))
|
|
43
|
+
printf '%*s' "$filled" '' | tr ' ' '='
|
|
44
|
+
printf '%*s' "$empty" '' | tr ' ' '-'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# git utilities
|
|
48
|
+
num_or_zero() { v="$1"; [[ "$v" =~ ^[0-9]+$ ]] && echo "$v" || echo 0; }
|
|
49
|
+
|
|
50
|
+
# ---- basics ----
|
|
51
|
+
if command -v jq >/dev/null 2>&1; then
|
|
52
|
+
current_dir=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // "unknown"' 2>/dev/null | sed "s|^$HOME|~|g")
|
|
53
|
+
model_name=$(echo "$input" | jq -r '.model.display_name // "Claude"' 2>/dev/null)
|
|
54
|
+
model_version=$(echo "$input" | jq -r '.model.version // ""' 2>/dev/null)
|
|
55
|
+
else
|
|
56
|
+
current_dir="unknown"
|
|
57
|
+
model_name="Claude"; model_version=""
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# ---- git colors ----
|
|
61
|
+
git_color() { if [ "$use_color" -eq 1 ]; then printf '\033[1;32m'; fi; }
|
|
62
|
+
rst() { if [ "$use_color" -eq 1 ]; then printf '\033[0m'; fi; }
|
|
63
|
+
|
|
64
|
+
# ---- git ----
|
|
65
|
+
git_branch=""
|
|
66
|
+
if git rev-parse --git-dir >/dev/null 2>&1; then
|
|
67
|
+
git_branch=$(git branch --show-current 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# ---- usage colors ----
|
|
71
|
+
usage_color() { if [ "$use_color" -eq 1 ]; then printf '\033[1;35m'; fi; }
|
|
72
|
+
cost_color() { if [ "$use_color" -eq 1 ]; then printf '\033[1;36m'; fi; }
|
|
73
|
+
session_color() {
|
|
74
|
+
rem_pct=$(( 100 - session_pct ))
|
|
75
|
+
if (( rem_pct <= 10 )); then SCLR='1;31'
|
|
76
|
+
elif (( rem_pct <= 25 )); then SCLR='1;33'
|
|
77
|
+
else SCLR='1;32'; fi
|
|
78
|
+
if [ "$use_color" -eq 1 ]; then printf '\033[%sm' "$SCLR"; fi
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# ---- ccusage integration ----
|
|
82
|
+
session_txt=""; session_pct=0; session_bar=""
|
|
83
|
+
cost_usd=""; cost_per_hour=""; tpm=""; tot_tokens=""
|
|
84
|
+
|
|
85
|
+
if command -v jq >/dev/null 2>&1; then
|
|
86
|
+
blocks_output=$(npx ccusage@latest blocks --json 2>/dev/null || ccusage blocks --json 2>/dev/null)
|
|
87
|
+
if [ -n "$blocks_output" ]; then
|
|
88
|
+
active_block=$(echo "$blocks_output" | jq -c '.blocks[] | select(.isActive == true)' 2>/dev/null | head -n1)
|
|
89
|
+
if [ -n "$active_block" ]; then
|
|
90
|
+
cost_usd=$(echo "$active_block" | jq -r '.costUSD // empty')
|
|
91
|
+
cost_per_hour=$(echo "$active_block" | jq -r '.burnRate.costPerHour // empty')
|
|
92
|
+
tot_tokens=$(echo "$active_block" | jq -r '.totalTokens // empty')
|
|
93
|
+
|
|
94
|
+
# Session time calculation
|
|
95
|
+
reset_time_str=$(echo "$active_block" | jq -r '.usageLimitResetTime // .endTime // empty')
|
|
96
|
+
start_time_str=$(echo "$active_block" | jq -r '.startTime // empty')
|
|
97
|
+
|
|
98
|
+
if [ -n "$reset_time_str" ] && [ -n "$start_time_str" ]; then
|
|
99
|
+
start_sec=$(to_epoch "$start_time_str"); end_sec=$(to_epoch "$reset_time_str"); now_sec=$(date +%s)
|
|
100
|
+
total=$(( end_sec - start_sec )); (( total<1 )) && total=1
|
|
101
|
+
elapsed=$(( now_sec - start_sec )); (( elapsed<0 ))&&elapsed=0; (( elapsed>total ))&&elapsed=$total
|
|
102
|
+
session_pct=$(( elapsed * 100 / total ))
|
|
103
|
+
remaining=$(( end_sec - now_sec )); (( remaining<0 )) && remaining=0
|
|
104
|
+
rh=$(( remaining / 3600 )); rm=$(( (remaining % 3600) / 60 ))
|
|
105
|
+
end_hm=$(fmt_time_hm "$end_sec")
|
|
106
|
+
session_txt="$(printf '%dh %dm until reset at %s' "$rh" "$rm" "$end_hm")"
|
|
107
|
+
fi
|
|
108
|
+
fi
|
|
109
|
+
fi
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# ---- render statusline ----
|
|
113
|
+
printf '📁 %s%s%s' "$(dir_color)" "$current_dir" "$(rst)"
|
|
114
|
+
# git display
|
|
115
|
+
if [ -n "$git_branch" ]; then
|
|
116
|
+
printf ' 🌿 %s%s%s' "$(git_color)" "$git_branch" "$(rst)"
|
|
117
|
+
fi
|
|
118
|
+
printf ' 🤖 %s%s%s' "$(model_color)" "$model_name" "$(rst)"
|
|
119
|
+
if [ -n "$model_version" ] && [ "$model_version" != "null" ]; then
|
|
120
|
+
printf ' 🏷️ %s%s%s' "$(version_color)" "$model_version" "$(rst)"
|
|
121
|
+
fi
|
|
122
|
+
# session time
|
|
123
|
+
if [ -n "$session_txt" ]; then
|
|
124
|
+
printf ' ⌛ %s%s%s' "$(session_color)" "$session_txt" "$(rst)"
|
|
125
|
+
fi
|
|
126
|
+
# cost
|
|
127
|
+
if [ -n "$cost_usd" ] && [[ "$cost_usd" =~ ^[0-9.]+$ ]]; then
|
|
128
|
+
if [ -n "$cost_per_hour" ] && [[ "$cost_per_hour" =~ ^[0-9.]+$ ]]; then
|
|
129
|
+
printf ' 💵 %s$%.2f ($%.2f/h)%s' "$(cost_color)" "$cost_usd" "$cost_per_hour" "$(rst)"
|
|
130
|
+
else
|
|
131
|
+
printf ' 💵 %s$%.2f%s' "$(cost_color)" "$cost_usd" "$(rst)"
|
|
132
|
+
fi
|
|
133
|
+
fi
|
|
134
|
+
# tokens
|
|
135
|
+
if [ -n "$tot_tokens" ] && [[ "$tot_tokens" =~ ^[0-9]+$ ]]; then
|
|
136
|
+
if [ -n "$tpm" ] && [[ "$tpm" =~ ^[0-9.]+$ ]] && false; then
|
|
137
|
+
printf ' 📊 %s%s tok (%.0f tpm)%s' "$(usage_color)" "$tot_tokens" "$tpm" "$(rst)"
|
|
138
|
+
else
|
|
139
|
+
printf ' 📊 %s%s tok%s' "$(usage_color)" "$tot_tokens" "$(rst)"
|
|
140
|
+
fi
|
|
141
|
+
fi
|