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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/statusline.sh +24 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-minimal-statusline",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A minimal, elegant status line for Claude Code with gradient progress bar, git integration, and update notifications",
5
5
  "main": "statusline.sh",
6
6
  "bin": {
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
- # Checks both global (~/.claude/) and project-level (.claude/) settings
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
- check_autocompact_disabled() {
79
- grep -q '"autoCompactEnabled"[[:space:]]*:[[:space:]]*false' "$1" 2>/dev/null
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 settings
82
- if check_autocompact_disabled ~/.claude/settings.json; then
83
- autocompact_enabled="false"
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
- # Check project settings (overrides global, most specific wins)
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 first (project-level)
93
+ # Check git root if in a repo
89
94
  if [ -n "$git_root" ] && [ -f "$git_root/.claude/settings.json" ]; then
90
- if check_autocompact_disabled "$git_root/.claude/settings.json"; then
91
- autocompact_enabled="false"
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 current dir last (subdirectory can override project)
97
- if [ -n "$git_root" ] && [ "$git_root" != "$current_dir" ] && [ -f "$current_dir/.claude/settings.json" ]; then
98
- if check_autocompact_disabled "$current_dir/.claude/settings.json"; then
99
- autocompact_enabled="false"
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