oh-my-customcode 0.58.1 → 0.58.2
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/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -41,10 +41,10 @@ Implemented in `.claude/hooks/hooks.json` (PreToolUse → Agent/Task matcher).
|
|
|
41
41
|
### Format
|
|
42
42
|
|
|
43
43
|
```
|
|
44
|
-
{Cost} | {project} | {branch} | RL:{rate_limit}% | WL:{weekly_limit}% | CTX:{usage}%
|
|
44
|
+
{Cost} | {project} | {branch} | RL:{rate_limit}% {countdown} | WL:{weekly_limit}% {countdown} | CTX:{usage}%
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
Example: `$0.05 | my-project | develop | RL:45% | WL:72% | CTX:42%`
|
|
47
|
+
Example: `$0.05 | my-project | develop | RL:45% 3h20m | WL:72% 2d3h | CTX:42%`
|
|
48
48
|
|
|
49
49
|
### Configuration
|
|
50
50
|
|
|
@@ -81,6 +81,17 @@ The `RL:{rate_limit}%` segment only appears when Claude Code v2.1.80+ provides `
|
|
|
81
81
|
|
|
82
82
|
The `WL:{weekly_limit}%` segment shows the 7-day rolling rate limit percentage. Both RL and WL segments are omitted on older versions.
|
|
83
83
|
|
|
84
|
+
### Countdown Format
|
|
85
|
+
|
|
86
|
+
The `{countdown}` shows time until RL/WL resets. Omitted when data is unavailable.
|
|
87
|
+
|
|
88
|
+
| Remaining | Display | Example |
|
|
89
|
+
|-----------|---------|---------|
|
|
90
|
+
| >= 1 day | `{d}d{h}h` | `2d3h` |
|
|
91
|
+
| >= 1 hour | `{h}h{m}m` | `5h30m` |
|
|
92
|
+
| < 1 hour | `{m}m` | `45m` |
|
|
93
|
+
| expired/unavailable | (omitted) | `WL:72%` |
|
|
94
|
+
|
|
84
95
|
## Integration
|
|
85
96
|
|
|
86
97
|
Integrates with R007 (Agent ID), R008 (Tool ID), R009 (Parallel).
|
|
@@ -66,9 +66,9 @@ fi
|
|
|
66
66
|
|
|
67
67
|
# ---------------------------------------------------------------------------
|
|
68
68
|
# 4. Single jq call — extract all fields as TSV
|
|
69
|
-
# Fields: model_name, project_dir, ctx_pct, ctx_size, cost_usd, rl_5h_pct, rl_7d_pct
|
|
69
|
+
# Fields: model_name, project_dir, ctx_pct, ctx_size, cost_usd, rl_5h_pct, rl_7d_pct, rl_5h_resets, rl_7d_resets
|
|
70
70
|
# ---------------------------------------------------------------------------
|
|
71
|
-
IFS=$'\t' read -r model_name project_dir ctx_pct ctx_size cost_usd rl_5h_pct rl_7d_pct <<< "$(
|
|
71
|
+
IFS=$'\t' read -r model_name project_dir ctx_pct ctx_size cost_usd rl_5h_pct rl_7d_pct rl_5h_resets rl_7d_resets <<< "$(
|
|
72
72
|
printf '%s' "$json" | jq -r '[
|
|
73
73
|
(.model.display_name // "unknown"),
|
|
74
74
|
(.workspace.current_dir // ""),
|
|
@@ -76,7 +76,9 @@ IFS=$'\t' read -r model_name project_dir ctx_pct ctx_size cost_usd rl_5h_pct rl_
|
|
|
76
76
|
(.context_window.context_window_size // 0),
|
|
77
77
|
(.cost.total_cost_usd // 0),
|
|
78
78
|
(.rate_limits.five_hour.used_percentage // -1),
|
|
79
|
-
(.rate_limits.seven_day.used_percentage // -1)
|
|
79
|
+
(.rate_limits.seven_day.used_percentage // -1),
|
|
80
|
+
(.rate_limits.five_hour.resets_at // -1),
|
|
81
|
+
(.rate_limits.seven_day.resets_at // -1)
|
|
80
82
|
] | @tsv'
|
|
81
83
|
)"
|
|
82
84
|
|
|
@@ -85,7 +87,32 @@ IFS=$'\t' read -r model_name project_dir ctx_pct ctx_size cost_usd rl_5h_pct rl_
|
|
|
85
87
|
# ---------------------------------------------------------------------------
|
|
86
88
|
COST_BRIDGE_FILE="/tmp/.claude-cost-${PPID}"
|
|
87
89
|
_tmp="${COST_BRIDGE_FILE}.tmp.$$"
|
|
88
|
-
printf '%s\t%s\t%s\t%s\t%s\n' "$cost_usd" "$ctx_pct" "$(date +%s)" "$rl_5h_pct" "$rl_7d_pct" > "$_tmp" 2>/dev/null && mv -f "$_tmp" "$COST_BRIDGE_FILE" 2>/dev/null || true
|
|
90
|
+
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$cost_usd" "$ctx_pct" "$(date +%s)" "$rl_5h_pct" "$rl_7d_pct" "$rl_5h_resets" "$rl_7d_resets" > "$_tmp" 2>/dev/null && mv -f "$_tmp" "$COST_BRIDGE_FILE" 2>/dev/null || true
|
|
91
|
+
|
|
92
|
+
# ---------------------------------------------------------------------------
|
|
93
|
+
# 4c. Countdown helper — converts resets_at epoch to human-readable duration
|
|
94
|
+
# ---------------------------------------------------------------------------
|
|
95
|
+
_countdown() {
|
|
96
|
+
local resets_at="$1"
|
|
97
|
+
if [[ "$resets_at" =~ ^[0-9]+$ ]] && [[ "$resets_at" -gt 0 ]]; then
|
|
98
|
+
local now
|
|
99
|
+
now=$(date +%s)
|
|
100
|
+
local remaining=$((resets_at - now))
|
|
101
|
+
if [[ "$remaining" -gt 0 ]]; then
|
|
102
|
+
local days=$((remaining / 86400))
|
|
103
|
+
local hours=$(( (remaining % 86400) / 3600 ))
|
|
104
|
+
if [[ "$days" -gt 0 ]]; then
|
|
105
|
+
printf '%dd%dh' "$days" "$hours"
|
|
106
|
+
elif [[ "$hours" -gt 0 ]]; then
|
|
107
|
+
local mins=$(( (remaining % 3600) / 60 ))
|
|
108
|
+
printf '%dh%dm' "$hours" "$mins"
|
|
109
|
+
else
|
|
110
|
+
local mins=$((remaining / 60))
|
|
111
|
+
printf '%dm' "$mins"
|
|
112
|
+
fi
|
|
113
|
+
fi
|
|
114
|
+
fi
|
|
115
|
+
}
|
|
89
116
|
|
|
90
117
|
# ---------------------------------------------------------------------------
|
|
91
118
|
# 5. Model display name + color (bash 3.2 compatible case pattern matching)
|
|
@@ -271,6 +298,12 @@ if [[ "$rl_5h_int" -ge 0 ]]; then
|
|
|
271
298
|
fi
|
|
272
299
|
fi
|
|
273
300
|
|
|
301
|
+
# Append countdown to RL display if available
|
|
302
|
+
rl_countdown="$(_countdown "$rl_5h_resets")"
|
|
303
|
+
if [[ -n "$rl_countdown" && -n "$rl_display" ]]; then
|
|
304
|
+
rl_display="${rl_display} ${rl_countdown}"
|
|
305
|
+
fi
|
|
306
|
+
|
|
274
307
|
# ---------------------------------------------------------------------------
|
|
275
308
|
# 9c. Weekly rate limit percentage with color (v2.1.80+, optional)
|
|
276
309
|
# ---------------------------------------------------------------------------
|
|
@@ -292,6 +325,12 @@ if [[ "$wl_7d_int" -ge 0 ]]; then
|
|
|
292
325
|
fi
|
|
293
326
|
fi
|
|
294
327
|
|
|
328
|
+
# Append countdown to WL display if available
|
|
329
|
+
wl_countdown="$(_countdown "$rl_7d_resets")"
|
|
330
|
+
if [[ -n "$wl_countdown" && -n "$wl_display" ]]; then
|
|
331
|
+
wl_display="${wl_display} ${wl_countdown}"
|
|
332
|
+
fi
|
|
333
|
+
|
|
295
334
|
# ---------------------------------------------------------------------------
|
|
296
335
|
# 10. Assemble and output the status line
|
|
297
336
|
# ---------------------------------------------------------------------------
|
package/templates/manifest.json
CHANGED