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 +1 -0
- package/package.json +1 -1
- package/preview2.png +0 -0
- package/scripts/postinstall.js +23 -57
- package/statusline.sh +24 -21
package/README.md
CHANGED
package/package.json
CHANGED
package/preview2.png
ADDED
|
Binary file
|
package/scripts/postinstall.js
CHANGED
|
@@ -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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
output: process.stdout
|
|
64
|
-
});
|
|
35
|
+
// Add statusLine config
|
|
36
|
+
settings.statusLine = statusLineConfig;
|
|
65
37
|
|
|
66
|
-
|
|
38
|
+
// Write settings
|
|
39
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
67
40
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
#
|
|
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
|