@paulduvall/claude-dev-toolkit 0.0.1-alpha.18 → 0.0.1-alpha.19
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/setup-command.js
CHANGED
|
@@ -196,22 +196,59 @@ class SetupCommand {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
* Install hooks
|
|
199
|
+
* Install hooks and their lib/ dependencies to ~/.claude/hooks/
|
|
200
200
|
*/
|
|
201
201
|
async installHooks() {
|
|
202
202
|
console.log('🎣 Installing hooks...');
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
try {
|
|
205
|
-
// Check if hooks installer is available
|
|
206
205
|
const hooksInstaller = require('./hook-installer');
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
const targetHooksDir = path.join(this.claudeDir, 'hooks');
|
|
207
|
+
const availableHooks = hooksInstaller.getAvailableHooks();
|
|
208
|
+
const hookNames = availableHooks.map(h => h.name);
|
|
209
|
+
|
|
210
|
+
const result = hooksInstaller.installSecurityHooks(
|
|
211
|
+
targetHooksDir,
|
|
212
|
+
hookNames,
|
|
213
|
+
{ force: true, backup: true }
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
if (result.success) {
|
|
217
|
+
console.log(` ✅ ${result.installed.length} hooks installed`);
|
|
218
|
+
} else {
|
|
219
|
+
console.log(` ⚠️ Hook installation had issues: ${result.errors.join(', ')}`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Copy lib/ directory (shared modules required by most hooks)
|
|
223
|
+
this._installHookLibs(targetHooksDir);
|
|
224
|
+
|
|
209
225
|
} catch (error) {
|
|
210
226
|
console.log(` ⚠️ Hooks installation skipped: ${error.message}`);
|
|
211
|
-
// Don't fail setup for hooks
|
|
212
227
|
}
|
|
213
228
|
}
|
|
214
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Copy hooks/lib/ modules to target directory
|
|
232
|
+
*/
|
|
233
|
+
_installHookLibs(targetHooksDir) {
|
|
234
|
+
const sourceLibDir = path.join(__dirname, '..', 'hooks', 'lib');
|
|
235
|
+
const targetLibDir = path.join(targetHooksDir, 'lib');
|
|
236
|
+
|
|
237
|
+
if (!fs.existsSync(sourceLibDir)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
fs.mkdirSync(targetLibDir, { recursive: true });
|
|
242
|
+
|
|
243
|
+
const libFiles = fs.readdirSync(sourceLibDir).filter(f => f.endsWith('.sh'));
|
|
244
|
+
for (const file of libFiles) {
|
|
245
|
+
const content = fs.readFileSync(path.join(sourceLibDir, file), 'utf8');
|
|
246
|
+
fs.writeFileSync(path.join(targetLibDir, file), content, { mode: 0o755 });
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
console.log(` ✅ ${libFiles.length} lib modules installed`);
|
|
250
|
+
}
|
|
251
|
+
|
|
215
252
|
/**
|
|
216
253
|
* Verify setup completion
|
|
217
254
|
*/
|
|
@@ -241,6 +278,19 @@ class SetupCommand {
|
|
|
241
278
|
issues.push('Cannot read commands directory');
|
|
242
279
|
}
|
|
243
280
|
|
|
281
|
+
// Check hooks installation
|
|
282
|
+
const hooksDir = path.join(this.claudeDir, 'hooks');
|
|
283
|
+
if (fs.existsSync(hooksDir)) {
|
|
284
|
+
const hooks = fs.readdirSync(hooksDir).filter(f => f.endsWith('.sh'));
|
|
285
|
+
if (hooks.length > 0) {
|
|
286
|
+
console.log(` ✅ ${hooks.length} hooks installed`);
|
|
287
|
+
} else {
|
|
288
|
+
issues.push('Hooks directory exists but no hooks found');
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
issues.push('Hooks directory not found');
|
|
292
|
+
}
|
|
293
|
+
|
|
244
294
|
// Check configuration
|
|
245
295
|
if (fs.existsSync(this.settingsFile)) {
|
|
246
296
|
console.log(' ✅ Configuration file present');
|
package/package.json
CHANGED
|
@@ -25,7 +25,25 @@
|
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
27
|
"hooks": {
|
|
28
|
-
"PreToolUse": [
|
|
28
|
+
"PreToolUse": [
|
|
29
|
+
{
|
|
30
|
+
"matcher": "Edit|Write|MultiEdit",
|
|
31
|
+
"hooks": [
|
|
32
|
+
{
|
|
33
|
+
"type": "command",
|
|
34
|
+
"command": "~/.claude/hooks/prevent-credential-exposure.sh",
|
|
35
|
+
"blocking": true,
|
|
36
|
+
"timeout": 10000
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "command",
|
|
40
|
+
"command": "~/.claude/hooks/verify-before-edit.sh",
|
|
41
|
+
"blocking": false,
|
|
42
|
+
"timeout": 5000
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
29
47
|
"PostToolUse": []
|
|
30
48
|
},
|
|
31
49
|
"env": {
|
|
@@ -32,8 +32,25 @@
|
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
"hooks": {
|
|
35
|
-
"PreToolUse": [
|
|
36
|
-
|
|
35
|
+
"PreToolUse": [
|
|
36
|
+
{
|
|
37
|
+
"matcher": "Edit|Write|MultiEdit",
|
|
38
|
+
"hooks": [
|
|
39
|
+
{
|
|
40
|
+
"type": "command",
|
|
41
|
+
"command": "~/.claude/hooks/prevent-credential-exposure.sh",
|
|
42
|
+
"blocking": true,
|
|
43
|
+
"timeout": 10000
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "command",
|
|
47
|
+
"command": "~/.claude/hooks/verify-before-edit.sh",
|
|
48
|
+
"blocking": false,
|
|
49
|
+
"timeout": 5000
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
37
54
|
},
|
|
38
55
|
"env": {
|
|
39
56
|
"DISABLE_TELEMETRY": "1",
|