zuppaclaude 1.3.15 → 1.3.16
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/lib/components/claudehud.js +109 -101
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Claude HUD component installer
|
|
3
|
+
* Auto-installs and configures the statusline HUD
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
const fs = require('fs');
|
|
@@ -7,18 +8,37 @@ const path = require('path');
|
|
|
7
8
|
const { Logger } = require('../utils/logger');
|
|
8
9
|
const { Platform } = require('../utils/platform');
|
|
9
10
|
|
|
11
|
+
const HUD_REPO = 'https://github.com/jarrodwatts/claude-hud.git';
|
|
12
|
+
|
|
10
13
|
class ClaudeHUDInstaller {
|
|
11
14
|
constructor() {
|
|
12
15
|
this.platform = new Platform();
|
|
13
16
|
this.logger = new Logger();
|
|
14
|
-
this.
|
|
17
|
+
this.hudDir = path.join(this.platform.claudeDir, 'plugins', 'claude-hud');
|
|
18
|
+
this.settingsPath = path.join(this.platform.claudeDir, 'settings.json');
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
|
-
* Check if Claude HUD
|
|
22
|
+
* Check if Claude HUD is installed
|
|
19
23
|
*/
|
|
20
24
|
isInstalled() {
|
|
21
|
-
|
|
25
|
+
const distPath = path.join(this.hudDir, 'dist', 'index.js');
|
|
26
|
+
return fs.existsSync(distPath);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Check if statusline is configured
|
|
31
|
+
*/
|
|
32
|
+
isConfigured() {
|
|
33
|
+
if (!fs.existsSync(this.settingsPath)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const settings = JSON.parse(fs.readFileSync(this.settingsPath, 'utf8'));
|
|
38
|
+
return settings.statusLine?.command?.includes('claude-hud');
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
22
42
|
}
|
|
23
43
|
|
|
24
44
|
/**
|
|
@@ -52,7 +72,7 @@ class ClaudeHUDInstaller {
|
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
/**
|
|
55
|
-
* Install Claude HUD
|
|
75
|
+
* Install Claude HUD
|
|
56
76
|
*/
|
|
57
77
|
async install() {
|
|
58
78
|
this.logger.step('Step 6/7: Installing Claude HUD (Status Display)');
|
|
@@ -68,28 +88,44 @@ class ClaudeHUDInstaller {
|
|
|
68
88
|
return false;
|
|
69
89
|
}
|
|
70
90
|
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
// Check if git is available
|
|
92
|
+
if (!this.platform.commandExists('git')) {
|
|
93
|
+
this.logger.warning('Git not found, skipping Claude HUD');
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
73
96
|
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
try {
|
|
98
|
+
// Create plugins directory
|
|
99
|
+
const pluginsDir = path.join(this.platform.claudeDir, 'plugins');
|
|
100
|
+
this.platform.ensureDir(pluginsDir);
|
|
101
|
+
|
|
102
|
+
// Clone or update repository
|
|
103
|
+
if (fs.existsSync(this.hudDir)) {
|
|
104
|
+
this.logger.info('Updating Claude HUD...');
|
|
105
|
+
this.platform.exec(`cd "${this.hudDir}" && git pull`, { silent: true });
|
|
76
106
|
} else {
|
|
77
|
-
|
|
107
|
+
this.logger.info('Cloning Claude HUD...');
|
|
108
|
+
this.platform.exec(`git clone "${HUD_REPO}" "${this.hudDir}"`, { silent: true });
|
|
78
109
|
}
|
|
79
110
|
|
|
80
|
-
|
|
111
|
+
// Install dependencies
|
|
112
|
+
this.logger.info('Installing dependencies...');
|
|
113
|
+
this.platform.exec(`cd "${this.hudDir}" && npm install --silent`, { silent: true });
|
|
114
|
+
|
|
115
|
+
// Build
|
|
116
|
+
this.logger.info('Building Claude HUD...');
|
|
117
|
+
this.platform.exec(`cd "${this.hudDir}" && npm run build`, { silent: true });
|
|
118
|
+
|
|
119
|
+
// Verify build
|
|
120
|
+
const distPath = path.join(this.hudDir, 'dist', 'index.js');
|
|
121
|
+
if (!fs.existsSync(distPath)) {
|
|
122
|
+
throw new Error('Build failed - dist/index.js not found');
|
|
123
|
+
}
|
|
81
124
|
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
console.log(' \x1b[36m┌─────────────────────────────────────────────────────┐\x1b[0m');
|
|
85
|
-
console.log(' \x1b[36m│\x1b[0m Run these commands inside Claude Code: \x1b[36m│\x1b[0m');
|
|
86
|
-
console.log(' \x1b[36m│\x1b[0m \x1b[36m│\x1b[0m');
|
|
87
|
-
console.log(' \x1b[36m│\x1b[0m 1. /plugin marketplace add jarrodwatts/claude-hud \x1b[36m│\x1b[0m');
|
|
88
|
-
console.log(' \x1b[36m│\x1b[0m 2. /plugin install claude-hud \x1b[36m│\x1b[0m');
|
|
89
|
-
console.log(' \x1b[36m│\x1b[0m 3. /claude-hud:setup \x1b[36m│\x1b[0m');
|
|
90
|
-
console.log(' \x1b[36m└─────────────────────────────────────────────────────┘\x1b[0m');
|
|
91
|
-
console.log('');
|
|
125
|
+
// Configure statusline
|
|
126
|
+
this.configureStatusLine();
|
|
92
127
|
|
|
128
|
+
this.logger.success('Claude HUD installed and activated');
|
|
93
129
|
return true;
|
|
94
130
|
} catch (error) {
|
|
95
131
|
this.logger.error(`Failed to install Claude HUD: ${error.message}`);
|
|
@@ -98,97 +134,65 @@ class ClaudeHUDInstaller {
|
|
|
98
134
|
}
|
|
99
135
|
|
|
100
136
|
/**
|
|
101
|
-
*
|
|
137
|
+
* Configure statusline in settings.json
|
|
102
138
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
echo ""
|
|
115
|
-
echo -e " \\033[0;36m1. /plugin marketplace add jarrodwatts/claude-hud\\033[0m"
|
|
116
|
-
echo -e " \\033[0;36m2. /plugin install claude-hud\\033[0m"
|
|
117
|
-
echo -e " \\033[0;36m3. /claude-hud:setup\\033[0m"
|
|
118
|
-
echo ""
|
|
119
|
-
echo "Claude HUD provides:"
|
|
120
|
-
echo " • Real-time context usage meter"
|
|
121
|
-
echo " • Active tool tracking"
|
|
122
|
-
echo " • Running agent status"
|
|
123
|
-
echo " • Todo progress display"
|
|
124
|
-
echo ""
|
|
125
|
-
`;
|
|
126
|
-
|
|
127
|
-
fs.writeFileSync(this.binPath, script, 'utf8');
|
|
128
|
-
fs.chmodSync(this.binPath, 0o755);
|
|
129
|
-
}
|
|
139
|
+
configureStatusLine() {
|
|
140
|
+
let settings = {};
|
|
141
|
+
|
|
142
|
+
// Load existing settings
|
|
143
|
+
if (fs.existsSync(this.settingsPath)) {
|
|
144
|
+
try {
|
|
145
|
+
settings = JSON.parse(fs.readFileSync(this.settingsPath, 'utf8'));
|
|
146
|
+
} catch {
|
|
147
|
+
settings = {};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
130
150
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Write-Host " Claude HUD Setup" -ForegroundColor Magenta
|
|
143
|
-
Write-Host "=======================================================================" -ForegroundColor Magenta
|
|
144
|
-
Write-Host ""
|
|
145
|
-
Write-Host "Run these commands inside Claude Code to install Claude HUD:"
|
|
146
|
-
Write-Host ""
|
|
147
|
-
Write-Host " 1. /plugin marketplace add jarrodwatts/claude-hud" -ForegroundColor Cyan
|
|
148
|
-
Write-Host " 2. /plugin install claude-hud" -ForegroundColor Cyan
|
|
149
|
-
Write-Host " 3. /claude-hud:setup" -ForegroundColor Cyan
|
|
150
|
-
Write-Host ""
|
|
151
|
-
Write-Host "Claude HUD provides:"
|
|
152
|
-
Write-Host " - Real-time context usage meter"
|
|
153
|
-
Write-Host " - Active tool tracking"
|
|
154
|
-
Write-Host " - Running agent status"
|
|
155
|
-
Write-Host " - Todo progress display"
|
|
156
|
-
Write-Host ""
|
|
157
|
-
`;
|
|
158
|
-
|
|
159
|
-
const cmdScript = `@echo off
|
|
160
|
-
powershell -ExecutionPolicy Bypass -File "%~dp0setup-claude-hud.ps1" %*
|
|
161
|
-
`;
|
|
162
|
-
|
|
163
|
-
fs.writeFileSync(ps1Path, ps1Script, 'utf8');
|
|
164
|
-
fs.writeFileSync(this.binPath, cmdScript, 'utf8');
|
|
151
|
+
// Configure statusLine
|
|
152
|
+
const hudScript = path.join(this.hudDir, 'dist', 'index.js');
|
|
153
|
+
settings.statusLine = {
|
|
154
|
+
type: 'command',
|
|
155
|
+
command: `node "${hudScript}"`,
|
|
156
|
+
padding: 0
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// Write settings
|
|
160
|
+
fs.writeFileSync(this.settingsPath, JSON.stringify(settings, null, 2), 'utf8');
|
|
161
|
+
this.logger.success('Statusline configured in settings.json');
|
|
165
162
|
}
|
|
166
163
|
|
|
167
164
|
/**
|
|
168
|
-
* Uninstall Claude HUD
|
|
165
|
+
* Uninstall Claude HUD
|
|
169
166
|
*/
|
|
170
167
|
uninstall() {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
let success = true;
|
|
169
|
+
|
|
170
|
+
// Remove HUD directory
|
|
171
|
+
if (fs.existsSync(this.hudDir)) {
|
|
172
|
+
try {
|
|
173
|
+
fs.rmSync(this.hudDir, { recursive: true });
|
|
174
|
+
this.logger.success('Claude HUD removed');
|
|
175
|
+
} catch (error) {
|
|
176
|
+
this.logger.warning(`Could not remove HUD directory: ${error.message}`);
|
|
177
|
+
success = false;
|
|
178
|
+
}
|
|
174
179
|
}
|
|
175
180
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
fs.
|
|
181
|
+
// Remove statusline from settings
|
|
182
|
+
if (fs.existsSync(this.settingsPath)) {
|
|
183
|
+
try {
|
|
184
|
+
const settings = JSON.parse(fs.readFileSync(this.settingsPath, 'utf8'));
|
|
185
|
+
if (settings.statusLine?.command?.includes('claude-hud')) {
|
|
186
|
+
delete settings.statusLine;
|
|
187
|
+
fs.writeFileSync(this.settingsPath, JSON.stringify(settings, null, 2), 'utf8');
|
|
188
|
+
this.logger.success('Statusline configuration removed');
|
|
183
189
|
}
|
|
190
|
+
} catch {
|
|
191
|
+
// Ignore errors
|
|
184
192
|
}
|
|
185
|
-
|
|
186
|
-
this.logger.success('Claude HUD setup script removed');
|
|
187
|
-
return true;
|
|
188
|
-
} catch (error) {
|
|
189
|
-
this.logger.error(`Failed to remove Claude HUD: ${error.message}`);
|
|
190
|
-
return false;
|
|
191
193
|
}
|
|
194
|
+
|
|
195
|
+
return success;
|
|
192
196
|
}
|
|
193
197
|
|
|
194
198
|
/**
|
|
@@ -196,8 +200,12 @@ powershell -ExecutionPolicy Bypass -File "%~dp0setup-claude-hud.ps1" %*
|
|
|
196
200
|
*/
|
|
197
201
|
verify() {
|
|
198
202
|
if (this.isInstalled()) {
|
|
199
|
-
this.logger.success('Claude HUD:
|
|
200
|
-
this.
|
|
203
|
+
this.logger.success('Claude HUD: Installed');
|
|
204
|
+
if (this.isConfigured()) {
|
|
205
|
+
this.logger.success('Statusline: Configured');
|
|
206
|
+
} else {
|
|
207
|
+
this.logger.warning('Statusline: Not configured');
|
|
208
|
+
}
|
|
201
209
|
return true;
|
|
202
210
|
} else {
|
|
203
211
|
this.logger.warning('Claude HUD: Not installed');
|