cc-minimal-statusline 1.0.2 → 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/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  A minimal status line for [Claude Code](https://github.com/anthropics/claude-code).
4
4
 
5
5
  ![Preview](preview.png)
6
+ ![Preview 2](preview2.png)
6
7
 
7
8
  ## Features
8
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-minimal-statusline",
3
- "version": "1.0.2",
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/preview2.png ADDED
Binary file
@@ -3,7 +3,6 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
- const readline = require('readline');
7
6
 
8
7
  const configDir = path.join(os.homedir(), '.claude');
9
8
  const settingsPath = path.join(configDir, 'settings.json');
@@ -14,65 +13,32 @@ const statusLineConfig = {
14
13
  padding: 0
15
14
  };
16
15
 
17
- function configureSettings() {
18
- // Create .claude directory if it doesn't exist
19
- if (!fs.existsSync(configDir)) {
20
- fs.mkdirSync(configDir, { recursive: true });
21
- }
22
-
23
- let settings = {};
24
-
25
- // Read existing settings if they exist
26
- if (fs.existsSync(settingsPath)) {
27
- try {
28
- const content = fs.readFileSync(settingsPath, 'utf8');
29
- settings = JSON.parse(content);
30
- } catch (e) {
31
- console.log('Warning: Could not parse existing settings.json, creating backup...');
32
- fs.copyFileSync(settingsPath, settingsPath + '.backup');
33
- settings = {};
34
- }
35
- }
36
-
37
- // Add statusLine config
38
- settings.statusLine = statusLineConfig;
39
-
40
- // Write settings
41
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
42
- console.log('\nāœ… Status line configured in ~/.claude/settings.json');
43
- console.log('\nšŸ’” Tip: Make sure you have a Nerd Font installed for icons to display correctly.');
44
- console.log(' brew install --cask font-meslo-lg-nerd-font\n');
16
+ // Create .claude directory if it doesn't exist
17
+ if (!fs.existsSync(configDir)) {
18
+ fs.mkdirSync(configDir, { recursive: true });
45
19
  }
46
20
 
47
- function showManualInstructions() {
48
- console.log('\nTo enable manually, add this to your ~/.claude/settings.json:\n');
49
- console.log(JSON.stringify({ statusLine: statusLineConfig }, null, 2));
50
- console.log('\nšŸ’” Tip: Make sure you have a Nerd Font installed for icons to display correctly.');
51
- console.log(' brew install --cask font-meslo-lg-nerd-font\n');
52
- }
53
-
54
- // Check if running in interactive terminal
55
- if (!process.stdin.isTTY) {
56
- console.log('\nšŸ“Š cc-minimal-statusline installed!');
57
- showManualInstructions();
58
- process.exit(0);
21
+ let settings = {};
22
+
23
+ // Read existing settings if they exist
24
+ if (fs.existsSync(settingsPath)) {
25
+ try {
26
+ const content = fs.readFileSync(settingsPath, 'utf8');
27
+ settings = JSON.parse(content);
28
+ } catch (e) {
29
+ console.log('Warning: Could not parse existing settings.json, creating backup...');
30
+ fs.copyFileSync(settingsPath, settingsPath + '.backup');
31
+ settings = {};
32
+ }
59
33
  }
60
34
 
61
- const rl = readline.createInterface({
62
- input: process.stdin,
63
- output: process.stdout
64
- });
35
+ // Add statusLine config
36
+ settings.statusLine = statusLineConfig;
65
37
 
66
- console.log('\nšŸ“Š cc-minimal-statusline installed!\n');
38
+ // Write settings
39
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
67
40
 
68
- rl.question('Configure Claude Code to use this status line? (Y/n) ', (answer) => {
69
- rl.close();
70
-
71
- const shouldConfigure = !answer || answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes';
72
-
73
- if (shouldConfigure) {
74
- configureSettings();
75
- } else {
76
- showManualInstructions();
77
- }
78
- });
41
+ console.log('\nšŸ“Š cc-minimal-statusline installed and configured!\n');
42
+ console.log('āœ… Added to ~/.claude/settings.json\n');
43
+ console.log('šŸ’” Tip: Make sure you have a Nerd Font installed for icons to display correctly.');
44
+ console.log(' brew install --cask font-meslo-lg-nerd-font\n');
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