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.
@@ -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.binPath = path.join(this.platform.localBin, this.platform.isWindows ? 'setup-claude-hud.cmd' : 'setup-claude-hud');
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 setup script is installed
22
+ * Check if Claude HUD is installed
19
23
  */
20
24
  isInstalled() {
21
- return fs.existsSync(this.binPath);
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 setup script
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
- try {
72
- this.platform.ensureDir(this.platform.localBin);
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
- if (this.platform.isWindows) {
75
- await this.createWindowsScript();
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
- await this.createUnixScript();
107
+ this.logger.info('Cloning Claude HUD...');
108
+ this.platform.exec(`git clone "${HUD_REPO}" "${this.hudDir}"`, { silent: true });
78
109
  }
79
110
 
80
- this.logger.success('Claude HUD setup script created');
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
- // Show setup instructions directly
83
- console.log('');
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
- * Create Unix setup script
137
+ * Configure statusline in settings.json
102
138
  */
103
- async createUnixScript() {
104
- const script = `#!/bin/bash
105
- # Claude HUD Setup Script
106
- # Run this script, then execute the commands inside Claude Code
107
-
108
- echo ""
109
- echo -e "\\033[0;35m╔═══════════════════════════════════════════════════════════════════╗\\033[0m"
110
- echo -e "\\033[0;35m║ Claude HUD Setup ║\\033[0m"
111
- echo -e "\\033[0;35m╚═══════════════════════════════════════════════════════════════════╝\\033[0m"
112
- echo ""
113
- echo "Run these commands inside Claude Code to install Claude HUD:"
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
- * Create Windows setup script
133
- */
134
- async createWindowsScript() {
135
- const ps1Path = this.binPath.replace('.cmd', '.ps1');
136
-
137
- const ps1Script = `# Claude HUD Setup Script
138
- # Run this script, then execute the commands inside Claude Code
139
-
140
- Write-Host ""
141
- Write-Host "=======================================================================" -ForegroundColor Magenta
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 setup script
165
+ * Uninstall Claude HUD
169
166
  */
170
167
  uninstall() {
171
- if (!this.isInstalled()) {
172
- this.logger.warning('Claude HUD setup script not found');
173
- return true;
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
- try {
177
- fs.unlinkSync(this.binPath);
178
-
179
- if (this.platform.isWindows) {
180
- const ps1Path = this.binPath.replace('.cmd', '.ps1');
181
- if (fs.existsSync(ps1Path)) {
182
- fs.unlinkSync(ps1Path);
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: Setup script ready');
200
- this.logger.info('Run \'setup-claude-hud\' for installation instructions');
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuppaclaude",
3
- "version": "1.3.15",
3
+ "version": "1.3.16",
4
4
  "description": "Claude Code power-up installer - SuperClaude + Spec Kit + Claude-Z + Claude HUD",
5
5
  "main": "lib/index.js",
6
6
  "bin": {