cc-minimal-statusline 1.0.3 → 1.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/package.json +1 -1
- package/statusline.sh +24 -21
package/package.json
CHANGED
package/statusline.sh
CHANGED
|
@@ -72,36 +72,39 @@ check_latest_version() {
|
|
|
72
72
|
|
|
73
73
|
is_outdated=$(check_latest_version)
|
|
74
74
|
|
|
75
|
-
# Check if autocompact is enabled (default: true)
|
|
76
|
-
#
|
|
75
|
+
# Check if autocompact is enabled (default: true at 95% threshold)
|
|
76
|
+
# Disabled if CLAUDE_AUTOCOMPACT_PCT_OVERRIDE >= 100 in env settings
|
|
77
77
|
autocompact_enabled="true"
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
get_autocompact_threshold() {
|
|
79
|
+
# Extract CLAUDE_AUTOCOMPACT_PCT_OVERRIDE from env section of settings.json
|
|
80
|
+
grep -o '"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE"[[:space:]]*:[[:space:]]*"[^"]*"' "$1" 2>/dev/null | \
|
|
81
|
+
sed 's/.*"\([0-9]*\)".*/\1/' | head -1
|
|
80
82
|
}
|
|
81
|
-
# Check global
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
# Check settings files (project overrides global)
|
|
84
|
+
threshold=""
|
|
85
|
+
# Global settings
|
|
86
|
+
if [ -f ~/.claude/settings.json ]; then
|
|
87
|
+
val=$(get_autocompact_threshold ~/.claude/settings.json)
|
|
88
|
+
[ -n "$val" ] && threshold="$val"
|
|
84
89
|
fi
|
|
85
|
-
#
|
|
90
|
+
# Project settings
|
|
86
91
|
if [ -n "$current_dir" ]; then
|
|
87
92
|
git_root=$(git -C "$current_dir" rev-parse --show-toplevel 2>/dev/null)
|
|
88
|
-
# Check git root
|
|
93
|
+
# Check git root if in a repo
|
|
89
94
|
if [ -n "$git_root" ] && [ -f "$git_root/.claude/settings.json" ]; then
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
elif grep -q '"autoCompactEnabled"[[:space:]]*:[[:space:]]*true' "$git_root/.claude/settings.json" 2>/dev/null; then
|
|
93
|
-
autocompact_enabled="true"
|
|
94
|
-
fi
|
|
95
|
+
val=$(get_autocompact_threshold "$git_root/.claude/settings.json")
|
|
96
|
+
[ -n "$val" ] && threshold="$val"
|
|
95
97
|
fi
|
|
96
|
-
# Check
|
|
97
|
-
if [ -
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
elif grep -q '"autoCompactEnabled"[[:space:]]*:[[:space:]]*true' "$current_dir/.claude/settings.json" 2>/dev/null; then
|
|
101
|
-
autocompact_enabled="true"
|
|
102
|
-
fi
|
|
98
|
+
# Check current_dir (if different from git root, or if not in a repo)
|
|
99
|
+
if [ -f "$current_dir/.claude/settings.json" ] && [ "$current_dir" != "$git_root" ]; then
|
|
100
|
+
val=$(get_autocompact_threshold "$current_dir/.claude/settings.json")
|
|
101
|
+
[ -n "$val" ] && threshold="$val"
|
|
103
102
|
fi
|
|
104
103
|
fi
|
|
104
|
+
# If threshold >= 100, autocompact is effectively disabled
|
|
105
|
+
if [ -n "$threshold" ] && [ "$threshold" -ge 100 ] 2>/dev/null; then
|
|
106
|
+
autocompact_enabled="false"
|
|
107
|
+
fi
|
|
105
108
|
|
|
106
109
|
# Adjust for autocompact buffer (22.5% reserved = 77.5% usable)
|
|
107
110
|
# Only apply when autocompact is enabled
|