cc-minimal-statusline 1.0.0 ā 1.0.3
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 +33 -10
- package/statusline.sh +27 -3
package/README.md
CHANGED
package/package.json
CHANGED
package/preview2.png
ADDED
|
Binary file
|
package/scripts/postinstall.js
CHANGED
|
@@ -4,18 +4,41 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const os = require('os');
|
|
6
6
|
|
|
7
|
-
const scriptPath = path.join(__dirname, '..', 'statusline.sh');
|
|
8
7
|
const configDir = path.join(os.homedir(), '.claude');
|
|
9
8
|
const settingsPath = path.join(configDir, 'settings.json');
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const statusLineConfig = {
|
|
11
|
+
type: 'command',
|
|
12
|
+
command: 'cc-minimal-statusline',
|
|
13
|
+
padding: 0
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Create .claude directory if it doesn't exist
|
|
17
|
+
if (!fs.existsSync(configDir)) {
|
|
18
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
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 = {};
|
|
18
32
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Add statusLine config
|
|
36
|
+
settings.statusLine = statusLineConfig;
|
|
37
|
+
|
|
38
|
+
// Write settings
|
|
39
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
40
|
+
|
|
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.');
|
|
21
44
|
console.log(' brew install --cask font-meslo-lg-nerd-font\n');
|
package/statusline.sh
CHANGED
|
@@ -73,11 +73,35 @@ check_latest_version() {
|
|
|
73
73
|
is_outdated=$(check_latest_version)
|
|
74
74
|
|
|
75
75
|
# Check if autocompact is enabled (default: true)
|
|
76
|
-
#
|
|
76
|
+
# Checks both global (~/.claude/) and project-level (.claude/) settings
|
|
77
77
|
autocompact_enabled="true"
|
|
78
|
-
|
|
78
|
+
check_autocompact_disabled() {
|
|
79
|
+
grep -q '"autoCompactEnabled"[[:space:]]*:[[:space:]]*false' "$1" 2>/dev/null
|
|
80
|
+
}
|
|
81
|
+
# Check global settings
|
|
82
|
+
if check_autocompact_disabled ~/.claude/settings.json; then
|
|
79
83
|
autocompact_enabled="false"
|
|
80
84
|
fi
|
|
85
|
+
# Check project settings (overrides global, most specific wins)
|
|
86
|
+
if [ -n "$current_dir" ]; then
|
|
87
|
+
git_root=$(git -C "$current_dir" rev-parse --show-toplevel 2>/dev/null)
|
|
88
|
+
# Check git root first (project-level)
|
|
89
|
+
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
|
+
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
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
81
105
|
|
|
82
106
|
# Adjust for autocompact buffer (22.5% reserved = 77.5% usable)
|
|
83
107
|
# Only apply when autocompact is enabled
|
|
@@ -284,7 +308,7 @@ build_status() {
|
|
|
284
308
|
|
|
285
309
|
# Files and lines changed from git status (only show if there are uncommitted changes)
|
|
286
310
|
if [ "$git_files" != "0" ] || [ "$git_added" != "0" ] || [ "$git_removed" != "0" ]; then
|
|
287
|
-
out="${out} ${sep} ${C_DIM}${ICON_FILES}${git_files}${C_RESET} ${C_GREEN}+${git_added}${C_DIM}/${C_RED}-${git_removed}${C_RESET}"
|
|
311
|
+
out="${out} ${sep} ${C_DIM}${ICON_FILES} ${git_files}${C_RESET} ${C_GREEN}+${git_added}${C_DIM}/${C_RED}-${git_removed}${C_RESET}"
|
|
288
312
|
fi
|
|
289
313
|
|
|
290
314
|
# Context percentage and bar (with compress icon if autocompact enabled)
|