@andrewkent/claude-statusline 1.1.8 → 1.1.10
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/assets/statusline.sh +32 -4
- package/package.json +1 -1
package/assets/statusline.sh
CHANGED
|
@@ -765,9 +765,26 @@ if [ -n "$usage_data" ] && echo "$usage_data" | jq -e . >/dev/null 2>&1; then
|
|
|
765
765
|
rate_lines+="${white}$(printf "%-7s" "current")${reset} ${five_hour_bar} ${five_hour_pct_color}$(printf "%5.1f" "$five_hour_pct_display")%${reset}"
|
|
766
766
|
[ -n "$five_hour_reset" ] && rate_lines+=" ${white}${five_hour_reset}${reset}"
|
|
767
767
|
|
|
768
|
+
# When at 100%, show countdown to reset
|
|
769
|
+
if [ "$five_hour_pct" -ge 100 ] 2>/dev/null && [ -n "$five_hour_reset_iso" ]; then
|
|
770
|
+
countdown_epoch=$(iso_to_epoch "$five_hour_reset_iso")
|
|
771
|
+
if [ -n "$countdown_epoch" ]; then
|
|
772
|
+
countdown_now=$(date +%s)
|
|
773
|
+
countdown_secs=$(( countdown_epoch - countdown_now ))
|
|
774
|
+
[ "$countdown_secs" -lt 0 ] && countdown_secs=0
|
|
775
|
+
countdown_mins=$(( countdown_secs / 60 ))
|
|
776
|
+
if [ "$countdown_mins" -ge 60 ] 2>/dev/null; then
|
|
777
|
+
countdown_display=$(awk "BEGIN { printf \"%.1fh\", $countdown_mins / 60 }")
|
|
778
|
+
else
|
|
779
|
+
countdown_display="${countdown_mins}m"
|
|
780
|
+
fi
|
|
781
|
+
rate_lines+=" ${red}resets ${countdown_display}${reset}"
|
|
782
|
+
fi
|
|
783
|
+
fi
|
|
784
|
+
|
|
768
785
|
# ── Burn-down projection ──────────────────────────
|
|
769
786
|
# Estimate minutes until 100% based on utilization velocity
|
|
770
|
-
if [ "$five_hour_pct" -gt
|
|
787
|
+
if [ "$five_hour_pct" -gt 0 ] 2>/dev/null && [ -n "$five_hour_reset_iso" ] && [ "$five_hour_reset_iso" != "" ]; then
|
|
771
788
|
reset_epoch=$(iso_to_epoch "$five_hour_reset_iso")
|
|
772
789
|
if [ -n "$reset_epoch" ]; then
|
|
773
790
|
now_bd=$(date +%s)
|
|
@@ -788,19 +805,30 @@ if [ -n "$usage_data" ] && echo "$usage_data" | jq -e . >/dev/null 2>&1; then
|
|
|
788
805
|
if (rate > 0) printf \"%.0f\", $remaining_pct / rate / 60;
|
|
789
806
|
else print 999
|
|
790
807
|
}")
|
|
791
|
-
if [ "$mins_to_full" -
|
|
808
|
+
if [ "$mins_to_full" -gt 0 ] 2>/dev/null && [ "$mins_to_full" -lt 6000 ] 2>/dev/null; then
|
|
792
809
|
bd_color="$green"
|
|
793
810
|
[ "$mins_to_full" -le 60 ] && bd_color="$orange"
|
|
794
811
|
[ "$mins_to_full" -le 30 ] && bd_color="$yellow"
|
|
795
812
|
[ "$mins_to_full" -le 15 ] && bd_color="$red"
|
|
796
|
-
|
|
813
|
+
|
|
814
|
+
if [ "$mins_to_full" -ge 60 ] 2>/dev/null; then
|
|
815
|
+
full_display=$(awk "BEGIN { printf \"%.1fh\", $mins_to_full / 60 }")
|
|
816
|
+
else
|
|
817
|
+
full_display="${mins_to_full}m"
|
|
818
|
+
fi
|
|
819
|
+
rate_lines+=" ${bd_color}→full ~${full_display}${reset}"
|
|
797
820
|
|
|
798
821
|
# Survive indicator: buffer or downtime until window resets
|
|
799
822
|
mins_to_reset=$(( secs_to_reset / 60 ))
|
|
800
823
|
if [ "$mins_to_reset" -gt 0 ] 2>/dev/null; then
|
|
801
824
|
if [ "$mins_to_full" -gt "$mins_to_reset" ] 2>/dev/null; then
|
|
802
825
|
buffer=$(( mins_to_full - mins_to_reset ))
|
|
803
|
-
|
|
826
|
+
if [ "$buffer" -ge 60 ] 2>/dev/null; then
|
|
827
|
+
buf_display=$(awk "BEGIN { printf \"%.1fh\", $buffer / 60 }")
|
|
828
|
+
else
|
|
829
|
+
buf_display="${buffer}m"
|
|
830
|
+
fi
|
|
831
|
+
rate_lines+=" ${green}✓${buf_display}${reset}"
|
|
804
832
|
else
|
|
805
833
|
downtime=$(( mins_to_reset - mins_to_full ))
|
|
806
834
|
if [ "$downtime" -ge 60 ] 2>/dev/null; then
|