zuppaclaude 1.0.0
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/LICENSE +21 -0
- package/README.md +487 -0
- package/bin/zuppaclaude.js +147 -0
- package/lib/components/claudehud.js +198 -0
- package/lib/components/claudez.js +205 -0
- package/lib/components/config.js +143 -0
- package/lib/components/index.js +17 -0
- package/lib/components/speckit.js +99 -0
- package/lib/components/superclaude.js +130 -0
- package/lib/index.js +17 -0
- package/lib/installer.js +241 -0
- package/lib/settings.js +243 -0
- package/lib/uninstaller.js +119 -0
- package/lib/utils/index.js +14 -0
- package/lib/utils/logger.js +79 -0
- package/lib/utils/platform.js +217 -0
- package/lib/utils/prompts.js +134 -0
- package/package.json +43 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude HUD component installer
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { Logger } = require('../utils/logger');
|
|
8
|
+
const { Platform } = require('../utils/platform');
|
|
9
|
+
|
|
10
|
+
class ClaudeHUDInstaller {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.platform = new Platform();
|
|
13
|
+
this.logger = new Logger();
|
|
14
|
+
this.binPath = path.join(this.platform.localBin, this.platform.isWindows ? 'setup-claude-hud.cmd' : 'setup-claude-hud');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Check if Claude HUD setup script is installed
|
|
19
|
+
*/
|
|
20
|
+
isInstalled() {
|
|
21
|
+
return fs.existsSync(this.binPath);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check Claude Code version
|
|
26
|
+
*/
|
|
27
|
+
checkVersion() {
|
|
28
|
+
if (!this.platform.commandExists('claude')) {
|
|
29
|
+
return { ok: false, version: null, message: 'Claude Code not found' };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const output = this.platform.exec('claude --version', { silent: true });
|
|
34
|
+
const match = output?.match(/(\d+)\.(\d+)\.(\d+)/);
|
|
35
|
+
|
|
36
|
+
if (match) {
|
|
37
|
+
const [, major, minor, patch] = match.map(Number);
|
|
38
|
+
const version = `${major}.${minor}.${patch}`;
|
|
39
|
+
|
|
40
|
+
// Check if version >= 1.0.80
|
|
41
|
+
if (major < 1 || (major === 1 && minor === 0 && patch < 80)) {
|
|
42
|
+
return { ok: false, version, message: `Version ${version} < 1.0.80` };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return { ok: true, version, message: null };
|
|
46
|
+
}
|
|
47
|
+
} catch {
|
|
48
|
+
// Ignore errors
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return { ok: true, version: 'unknown', message: null };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Install Claude HUD setup script
|
|
56
|
+
*/
|
|
57
|
+
async install() {
|
|
58
|
+
this.logger.step('Step 6/7: Installing Claude HUD (Status Display)');
|
|
59
|
+
|
|
60
|
+
// Check version
|
|
61
|
+
const versionCheck = this.checkVersion();
|
|
62
|
+
if (!versionCheck.ok) {
|
|
63
|
+
this.logger.warning(versionCheck.message);
|
|
64
|
+
if (versionCheck.version) {
|
|
65
|
+
this.logger.info('Claude HUD requires Claude Code v1.0.80 or later');
|
|
66
|
+
this.logger.info('Update with: npm update -g @anthropic-ai/claude-code');
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
this.platform.ensureDir(this.platform.localBin);
|
|
73
|
+
|
|
74
|
+
if (this.platform.isWindows) {
|
|
75
|
+
await this.createWindowsScript();
|
|
76
|
+
} else {
|
|
77
|
+
await this.createUnixScript();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.logger.success('Claude HUD setup script created');
|
|
81
|
+
this.logger.info('Run \'setup-claude-hud\' for installation instructions');
|
|
82
|
+
return true;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
this.logger.error(`Failed to install Claude HUD: ${error.message}`);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Create Unix setup script
|
|
91
|
+
*/
|
|
92
|
+
async createUnixScript() {
|
|
93
|
+
const script = `#!/bin/bash
|
|
94
|
+
# Claude HUD Setup Script
|
|
95
|
+
# Run this script, then execute the commands inside Claude Code
|
|
96
|
+
|
|
97
|
+
echo ""
|
|
98
|
+
echo -e "\\033[0;35m╔═══════════════════════════════════════════════════════════════════╗\\033[0m"
|
|
99
|
+
echo -e "\\033[0;35m║ Claude HUD Setup ║\\033[0m"
|
|
100
|
+
echo -e "\\033[0;35m╚═══════════════════════════════════════════════════════════════════╝\\033[0m"
|
|
101
|
+
echo ""
|
|
102
|
+
echo "Run these commands inside Claude Code to install Claude HUD:"
|
|
103
|
+
echo ""
|
|
104
|
+
echo -e " \\033[0;36m1. /plugin marketplace add jarrodwatts/claude-hud\\033[0m"
|
|
105
|
+
echo -e " \\033[0;36m2. /plugin install claude-hud\\033[0m"
|
|
106
|
+
echo -e " \\033[0;36m3. /claude-hud:setup\\033[0m"
|
|
107
|
+
echo ""
|
|
108
|
+
echo "Claude HUD provides:"
|
|
109
|
+
echo " • Real-time context usage meter"
|
|
110
|
+
echo " • Active tool tracking"
|
|
111
|
+
echo " • Running agent status"
|
|
112
|
+
echo " • Todo progress display"
|
|
113
|
+
echo ""
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
fs.writeFileSync(this.binPath, script, 'utf8');
|
|
117
|
+
fs.chmodSync(this.binPath, 0o755);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Create Windows setup script
|
|
122
|
+
*/
|
|
123
|
+
async createWindowsScript() {
|
|
124
|
+
const ps1Path = this.binPath.replace('.cmd', '.ps1');
|
|
125
|
+
|
|
126
|
+
const ps1Script = `# Claude HUD Setup Script
|
|
127
|
+
# Run this script, then execute the commands inside Claude Code
|
|
128
|
+
|
|
129
|
+
Write-Host ""
|
|
130
|
+
Write-Host "=======================================================================" -ForegroundColor Magenta
|
|
131
|
+
Write-Host " Claude HUD Setup" -ForegroundColor Magenta
|
|
132
|
+
Write-Host "=======================================================================" -ForegroundColor Magenta
|
|
133
|
+
Write-Host ""
|
|
134
|
+
Write-Host "Run these commands inside Claude Code to install Claude HUD:"
|
|
135
|
+
Write-Host ""
|
|
136
|
+
Write-Host " 1. /plugin marketplace add jarrodwatts/claude-hud" -ForegroundColor Cyan
|
|
137
|
+
Write-Host " 2. /plugin install claude-hud" -ForegroundColor Cyan
|
|
138
|
+
Write-Host " 3. /claude-hud:setup" -ForegroundColor Cyan
|
|
139
|
+
Write-Host ""
|
|
140
|
+
Write-Host "Claude HUD provides:"
|
|
141
|
+
Write-Host " - Real-time context usage meter"
|
|
142
|
+
Write-Host " - Active tool tracking"
|
|
143
|
+
Write-Host " - Running agent status"
|
|
144
|
+
Write-Host " - Todo progress display"
|
|
145
|
+
Write-Host ""
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
const cmdScript = `@echo off
|
|
149
|
+
powershell -ExecutionPolicy Bypass -File "%~dp0setup-claude-hud.ps1" %*
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
fs.writeFileSync(ps1Path, ps1Script, 'utf8');
|
|
153
|
+
fs.writeFileSync(this.binPath, cmdScript, 'utf8');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Uninstall Claude HUD setup script
|
|
158
|
+
*/
|
|
159
|
+
uninstall() {
|
|
160
|
+
if (!this.isInstalled()) {
|
|
161
|
+
this.logger.warning('Claude HUD setup script not found');
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
fs.unlinkSync(this.binPath);
|
|
167
|
+
|
|
168
|
+
if (this.platform.isWindows) {
|
|
169
|
+
const ps1Path = this.binPath.replace('.cmd', '.ps1');
|
|
170
|
+
if (fs.existsSync(ps1Path)) {
|
|
171
|
+
fs.unlinkSync(ps1Path);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.logger.success('Claude HUD setup script removed');
|
|
176
|
+
return true;
|
|
177
|
+
} catch (error) {
|
|
178
|
+
this.logger.error(`Failed to remove Claude HUD: ${error.message}`);
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Verify installation
|
|
185
|
+
*/
|
|
186
|
+
verify() {
|
|
187
|
+
if (this.isInstalled()) {
|
|
188
|
+
this.logger.success('Claude HUD: Setup script ready');
|
|
189
|
+
this.logger.info('Run \'setup-claude-hud\' for installation instructions');
|
|
190
|
+
return true;
|
|
191
|
+
} else {
|
|
192
|
+
this.logger.warning('Claude HUD: Not installed');
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
module.exports = { ClaudeHUDInstaller };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude-Z component installer
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { Logger } = require('../utils/logger');
|
|
8
|
+
const { Platform } = require('../utils/platform');
|
|
9
|
+
|
|
10
|
+
class ClaudeZInstaller {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.platform = new Platform();
|
|
13
|
+
this.logger = new Logger();
|
|
14
|
+
this.configDir = this.platform.zaiConfigDir;
|
|
15
|
+
this.binPath = path.join(this.platform.localBin, this.platform.isWindows ? 'claude-z.cmd' : 'claude-z');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Check if Claude-Z is installed
|
|
20
|
+
*/
|
|
21
|
+
isInstalled() {
|
|
22
|
+
return fs.existsSync(this.binPath);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Install Claude-Z
|
|
27
|
+
*/
|
|
28
|
+
async install(apiKey) {
|
|
29
|
+
this.logger.step('Step 5/7: Installing Claude-Z (z.ai backend)');
|
|
30
|
+
|
|
31
|
+
if (!apiKey) {
|
|
32
|
+
this.logger.info('Skipping Claude-Z installation (no API key provided)');
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
// Ensure directories exist
|
|
38
|
+
this.platform.ensureDir(this.configDir);
|
|
39
|
+
this.platform.ensureDir(this.platform.localBin);
|
|
40
|
+
|
|
41
|
+
// Save API key
|
|
42
|
+
const apiKeyPath = path.join(this.configDir, 'api_key');
|
|
43
|
+
fs.writeFileSync(apiKeyPath, apiKey, 'utf8');
|
|
44
|
+
fs.chmodSync(apiKeyPath, 0o600);
|
|
45
|
+
this.logger.success('Z.AI API key saved');
|
|
46
|
+
|
|
47
|
+
// Create claude-z script
|
|
48
|
+
if (this.platform.isWindows) {
|
|
49
|
+
await this.createWindowsScript();
|
|
50
|
+
} else {
|
|
51
|
+
await this.createUnixScript();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.logger.success('Claude-Z installed');
|
|
55
|
+
return true;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
this.logger.error(`Failed to install Claude-Z: ${error.message}`);
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create Unix claude-z script
|
|
64
|
+
*/
|
|
65
|
+
async createUnixScript() {
|
|
66
|
+
const script = `#!/bin/bash
|
|
67
|
+
#===============================================================================
|
|
68
|
+
# Claude-Z - Claude Code with z.ai backend
|
|
69
|
+
#===============================================================================
|
|
70
|
+
|
|
71
|
+
ZAI_CONFIG_DIR="$HOME/.config/zai"
|
|
72
|
+
API_KEY_FILE="$ZAI_CONFIG_DIR/api_key"
|
|
73
|
+
|
|
74
|
+
# Banner
|
|
75
|
+
echo ""
|
|
76
|
+
echo -e "\\033[0;35m╔═══════════════════════════════════════════════════════════════════╗\\033[0m"
|
|
77
|
+
echo -e "\\033[0;35m║ 🚀 Claude-Z - Claude Code with z.ai backend ║\\033[0m"
|
|
78
|
+
echo -e "\\033[0;35m╚═══════════════════════════════════════════════════════════════════╝\\033[0m"
|
|
79
|
+
echo ""
|
|
80
|
+
|
|
81
|
+
# Check for API key
|
|
82
|
+
if [ ! -f "$API_KEY_FILE" ]; then
|
|
83
|
+
echo -e "\\033[0;31m[✗] Z.AI API key not found\\033[0m"
|
|
84
|
+
echo "Run the installer again to configure Claude-Z"
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
ZAI_API_KEY=$(cat "$API_KEY_FILE")
|
|
89
|
+
|
|
90
|
+
# Export environment and run Claude
|
|
91
|
+
export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
|
|
92
|
+
export ANTHROPIC_API_KEY="$ZAI_API_KEY"
|
|
93
|
+
|
|
94
|
+
echo -e "\\033[0;32m[✓]\\033[0m Using z.ai backend"
|
|
95
|
+
echo -e "\\033[0;34m[i]\\033[0m Starting Claude Code..."
|
|
96
|
+
echo ""
|
|
97
|
+
|
|
98
|
+
exec claude "$@"
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
fs.writeFileSync(this.binPath, script, 'utf8');
|
|
102
|
+
fs.chmodSync(this.binPath, 0o755);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Create Windows claude-z script
|
|
107
|
+
*/
|
|
108
|
+
async createWindowsScript() {
|
|
109
|
+
const ps1Path = this.binPath.replace('.cmd', '.ps1');
|
|
110
|
+
|
|
111
|
+
const ps1Script = `#===============================================================================
|
|
112
|
+
# Claude-Z - Claude Code with z.ai backend
|
|
113
|
+
#===============================================================================
|
|
114
|
+
|
|
115
|
+
$ZAI_CONFIG_DIR = "$env:USERPROFILE\\.config\\zai"
|
|
116
|
+
$API_KEY_FILE = "$ZAI_CONFIG_DIR\\api_key"
|
|
117
|
+
|
|
118
|
+
# Banner
|
|
119
|
+
Write-Host ""
|
|
120
|
+
Write-Host "=======================================================================" -ForegroundColor Magenta
|
|
121
|
+
Write-Host " Claude-Z - Claude Code with z.ai backend" -ForegroundColor Magenta
|
|
122
|
+
Write-Host "=======================================================================" -ForegroundColor Magenta
|
|
123
|
+
Write-Host ""
|
|
124
|
+
|
|
125
|
+
# Check for API key
|
|
126
|
+
if (-not (Test-Path $API_KEY_FILE)) {
|
|
127
|
+
Write-Host "[X] Z.AI API key not found" -ForegroundColor Red
|
|
128
|
+
Write-Host "Run the installer again to configure Claude-Z"
|
|
129
|
+
exit 1
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
$ZAI_API_KEY = Get-Content $API_KEY_FILE -Raw
|
|
133
|
+
|
|
134
|
+
# Set environment and run Claude
|
|
135
|
+
$env:ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic"
|
|
136
|
+
$env:ANTHROPIC_API_KEY = $ZAI_API_KEY.Trim()
|
|
137
|
+
|
|
138
|
+
Write-Host "[OK] Using z.ai backend" -ForegroundColor Green
|
|
139
|
+
Write-Host "[i] Starting Claude Code..." -ForegroundColor Blue
|
|
140
|
+
Write-Host ""
|
|
141
|
+
|
|
142
|
+
& claude $args
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
const cmdScript = `@echo off
|
|
146
|
+
powershell -ExecutionPolicy Bypass -File "%~dp0claude-z.ps1" %*
|
|
147
|
+
`;
|
|
148
|
+
|
|
149
|
+
fs.writeFileSync(ps1Path, ps1Script, 'utf8');
|
|
150
|
+
fs.writeFileSync(this.binPath, cmdScript, 'utf8');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Uninstall Claude-Z
|
|
155
|
+
*/
|
|
156
|
+
uninstall() {
|
|
157
|
+
let success = true;
|
|
158
|
+
|
|
159
|
+
// Remove script
|
|
160
|
+
if (fs.existsSync(this.binPath)) {
|
|
161
|
+
fs.unlinkSync(this.binPath);
|
|
162
|
+
this.logger.success('Claude-Z script removed');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Remove PS1 on Windows
|
|
166
|
+
if (this.platform.isWindows) {
|
|
167
|
+
const ps1Path = this.binPath.replace('.cmd', '.ps1');
|
|
168
|
+
if (fs.existsSync(ps1Path)) {
|
|
169
|
+
fs.unlinkSync(ps1Path);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Remove config
|
|
174
|
+
if (fs.existsSync(this.configDir)) {
|
|
175
|
+
fs.rmSync(this.configDir, { recursive: true });
|
|
176
|
+
this.logger.success('Z.AI configuration removed');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return success;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Verify installation
|
|
184
|
+
*/
|
|
185
|
+
verify() {
|
|
186
|
+
const apiKeyPath = path.join(this.configDir, 'api_key');
|
|
187
|
+
|
|
188
|
+
if (this.isInstalled()) {
|
|
189
|
+
this.logger.success('Claude-Z: Installed');
|
|
190
|
+
} else {
|
|
191
|
+
this.logger.warning('Claude-Z: Not installed');
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (fs.existsSync(apiKeyPath)) {
|
|
196
|
+
this.logger.success('Z.AI API Key: Configured');
|
|
197
|
+
return true;
|
|
198
|
+
} else {
|
|
199
|
+
this.logger.warning('Z.AI API Key: Not configured');
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
module.exports = { ClaudeZInstaller };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration (CLAUDE.md) installer
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { Logger } = require('../utils/logger');
|
|
8
|
+
const { Platform } = require('../utils/platform');
|
|
9
|
+
|
|
10
|
+
const CONFIG_URL = 'https://raw.githubusercontent.com/hasankaantan/zuppaclaude/main/assets/CLAUDE.md';
|
|
11
|
+
|
|
12
|
+
class ConfigInstaller {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.platform = new Platform();
|
|
15
|
+
this.logger = new Logger();
|
|
16
|
+
this.configPath = path.join(this.platform.claudeDir, 'CLAUDE.md');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Check if config is installed
|
|
21
|
+
*/
|
|
22
|
+
isInstalled() {
|
|
23
|
+
return fs.existsSync(this.configPath);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Install CLAUDE.md configuration
|
|
28
|
+
*/
|
|
29
|
+
async install() {
|
|
30
|
+
this.logger.step('Step 4/7: Installing Configuration');
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
this.platform.ensureDir(this.platform.claudeDir);
|
|
34
|
+
|
|
35
|
+
// Backup existing config
|
|
36
|
+
if (this.isInstalled()) {
|
|
37
|
+
const timestamp = Date.now();
|
|
38
|
+
const backupPath = `${this.configPath}.backup.${timestamp}`;
|
|
39
|
+
fs.copyFileSync(this.configPath, backupPath);
|
|
40
|
+
this.logger.info(`Existing config backed up to: ${backupPath}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Download CLAUDE.md
|
|
44
|
+
this.logger.info('Downloading CLAUDE.md...');
|
|
45
|
+
await this.platform.download(CONFIG_URL, this.configPath);
|
|
46
|
+
|
|
47
|
+
this.logger.success('CLAUDE.md installed');
|
|
48
|
+
return true;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
this.logger.error(`Failed to install config: ${error.message}`);
|
|
51
|
+
|
|
52
|
+
// Create a basic fallback config
|
|
53
|
+
try {
|
|
54
|
+
this.logger.info('Creating fallback configuration...');
|
|
55
|
+
const fallbackConfig = this.getFallbackConfig();
|
|
56
|
+
fs.writeFileSync(this.configPath, fallbackConfig, 'utf8');
|
|
57
|
+
this.logger.success('Fallback CLAUDE.md created');
|
|
58
|
+
return true;
|
|
59
|
+
} catch (fallbackError) {
|
|
60
|
+
this.logger.error(`Failed to create fallback config: ${fallbackError.message}`);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get fallback configuration
|
|
68
|
+
*/
|
|
69
|
+
getFallbackConfig() {
|
|
70
|
+
return `# Claude Code - Enhanced System Instructions
|
|
71
|
+
|
|
72
|
+
## General Behavior
|
|
73
|
+
- Be proactive: After analysis ask "Should I implement?" or "Let's start?"
|
|
74
|
+
- Provide summary report when done (commit hash, changes, line count)
|
|
75
|
+
- Don't ask open-ended questions, suggest the best option
|
|
76
|
+
|
|
77
|
+
## SuperClaude Framework (Active)
|
|
78
|
+
SuperClaude slash commands are loaded. Use them proactively:
|
|
79
|
+
|
|
80
|
+
### Planning & Design
|
|
81
|
+
- \`/sc:brainstorm\` - Idea development and brainstorming
|
|
82
|
+
- \`/sc:design\` - Architectural design
|
|
83
|
+
- \`/sc:estimate\` - Time/resource estimation
|
|
84
|
+
|
|
85
|
+
### Development
|
|
86
|
+
- \`/sc:implement\` - Code implementation
|
|
87
|
+
- \`/sc:build\` - Build and compile
|
|
88
|
+
- \`/sc:improve\` - Code improvement
|
|
89
|
+
- \`/sc:explain\` - Code explanation
|
|
90
|
+
|
|
91
|
+
### Testing & Quality
|
|
92
|
+
- \`/sc:test\` - Test creation
|
|
93
|
+
- \`/sc:analyze\` - Code analysis
|
|
94
|
+
- \`/sc:troubleshoot\` - Debugging
|
|
95
|
+
|
|
96
|
+
### Project Management
|
|
97
|
+
- \`/sc:task\` - Task management
|
|
98
|
+
- \`/sc:workflow\` - Workflow management
|
|
99
|
+
- \`/sc:pm\` - Project management
|
|
100
|
+
|
|
101
|
+
## Response Format
|
|
102
|
+
- Short and concise answers
|
|
103
|
+
- Use Markdown formatting
|
|
104
|
+
- Specify language for code blocks
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Uninstall config
|
|
110
|
+
*/
|
|
111
|
+
uninstall() {
|
|
112
|
+
if (!this.isInstalled()) {
|
|
113
|
+
this.logger.warning('CLAUDE.md not found');
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const timestamp = Date.now();
|
|
119
|
+
const backupPath = `${this.configPath}.uninstall.${timestamp}`;
|
|
120
|
+
fs.renameSync(this.configPath, backupPath);
|
|
121
|
+
this.logger.success(`CLAUDE.md backed up to: ${backupPath}`);
|
|
122
|
+
return true;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
this.logger.error(`Failed to backup CLAUDE.md: ${error.message}`);
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Verify installation
|
|
131
|
+
*/
|
|
132
|
+
verify() {
|
|
133
|
+
if (this.isInstalled()) {
|
|
134
|
+
this.logger.success('CLAUDE.md: Installed');
|
|
135
|
+
return true;
|
|
136
|
+
} else {
|
|
137
|
+
this.logger.error('CLAUDE.md: Not installed');
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
module.exports = { ConfigInstaller };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component installers index
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const { SuperClaudeInstaller } = require('./superclaude');
|
|
6
|
+
const { SpecKitInstaller } = require('./speckit');
|
|
7
|
+
const { ConfigInstaller } = require('./config');
|
|
8
|
+
const { ClaudeZInstaller } = require('./claudez');
|
|
9
|
+
const { ClaudeHUDInstaller } = require('./claudehud');
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
SuperClaudeInstaller,
|
|
13
|
+
SpecKitInstaller,
|
|
14
|
+
ConfigInstaller,
|
|
15
|
+
ClaudeZInstaller,
|
|
16
|
+
ClaudeHUDInstaller
|
|
17
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec Kit component installer
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const { Logger } = require('../utils/logger');
|
|
6
|
+
const { Platform } = require('../utils/platform');
|
|
7
|
+
|
|
8
|
+
const PACKAGE_NAME = 'specify-cli';
|
|
9
|
+
|
|
10
|
+
class SpecKitInstaller {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.platform = new Platform();
|
|
13
|
+
this.logger = new Logger();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Check if Spec Kit is installed
|
|
18
|
+
*/
|
|
19
|
+
isInstalled() {
|
|
20
|
+
return this.platform.commandExists('specify');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Install Spec Kit
|
|
25
|
+
*/
|
|
26
|
+
async install() {
|
|
27
|
+
this.logger.step('Step 3/7: Installing Spec Kit (specify-cli)');
|
|
28
|
+
|
|
29
|
+
const pipCommand = this.platform.getPipCommand();
|
|
30
|
+
|
|
31
|
+
if (!pipCommand) {
|
|
32
|
+
this.logger.error('No Python package manager found (pip, pipx, or uv)');
|
|
33
|
+
this.logger.info('Please install Python 3.8+ with pip');
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
this.logger.info(`Installing ${PACKAGE_NAME} using ${pipCommand.split(' ')[0]}...`);
|
|
39
|
+
this.platform.exec(`${pipCommand} ${PACKAGE_NAME}`, { silent: true });
|
|
40
|
+
this.logger.success('Spec Kit installed');
|
|
41
|
+
return true;
|
|
42
|
+
} catch (error) {
|
|
43
|
+
this.logger.error(`Failed to install Spec Kit: ${error.message}`);
|
|
44
|
+
|
|
45
|
+
// Try fallback methods
|
|
46
|
+
const fallbacks = ['pipx install', 'pip3 install --user', 'pip install --user'];
|
|
47
|
+
for (const fallback of fallbacks) {
|
|
48
|
+
if (fallback === pipCommand) continue;
|
|
49
|
+
try {
|
|
50
|
+
this.logger.info(`Trying fallback: ${fallback}...`);
|
|
51
|
+
this.platform.exec(`${fallback} ${PACKAGE_NAME}`, { silent: true });
|
|
52
|
+
this.logger.success(`Spec Kit installed via ${fallback.split(' ')[0]}`);
|
|
53
|
+
return true;
|
|
54
|
+
} catch {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Uninstall Spec Kit
|
|
65
|
+
*/
|
|
66
|
+
uninstall() {
|
|
67
|
+
const pipCommand = this.platform.getPipUninstallCommand();
|
|
68
|
+
|
|
69
|
+
if (!pipCommand) {
|
|
70
|
+
this.logger.warning('No Python package manager found');
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
this.platform.exec(`${pipCommand} ${PACKAGE_NAME}`, { silent: true });
|
|
76
|
+
this.logger.success('Spec Kit removed');
|
|
77
|
+
return true;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
this.logger.warning(`Could not remove Spec Kit: ${error.message}`);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Verify installation
|
|
86
|
+
*/
|
|
87
|
+
verify() {
|
|
88
|
+
if (this.isInstalled()) {
|
|
89
|
+
this.logger.success('Spec Kit: Installed');
|
|
90
|
+
return true;
|
|
91
|
+
} else {
|
|
92
|
+
this.logger.warning('Spec Kit: Not found in PATH');
|
|
93
|
+
this.logger.info('You may need to add ~/.local/bin to your PATH');
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = { SpecKitInstaller };
|