claude-git-hooks 2.9.1 → 2.11.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/README.md CHANGED
@@ -1,848 +1,318 @@
1
- # Pre-commit Hook con Claude CLI
2
-
3
- 🚀 **Transforma tu flujo de desarrollo con IA**: análisis de código instantáneo, mensajes de commit automáticos y generación de PRs perfectas. Claude revisa tu código antes de cada commit, detecta issues críticos con análisis estructurado, y genera toda la documentación que necesitas. ¿Lo mejor? Se ejecuta localmente sin contaminar tu CI/CD.
4
-
5
- ## ✨ Novedad v2.7.1 - Improved Reliability
6
-
7
- **Nuevo v2.7.1**: Sistema de reintentos automáticos para errores transitorios de Claude API. Cuando Claude devuelve "Execution error" (típicamente por rate limiting), el sistema ahora reintenta automáticamente después de 2 segundos.
8
-
9
- ## ✨ Novedad v2.0.0 - Ahora Cross-Platform
10
-
11
- **¡Nueva arquitectura!** Migración completa a Node.js con ES6 modules para soporte más universal:
12
-
13
- - ✅ **Windows** - Git en Bash y Powershell
14
- - ✅ **WSL** - Subsistema de Linux
15
- - ✅ **Linux** - Funcionamiento nativo
16
- - ✅ **Worktrees** - Compatible con git worktrees en cualquier entorno
17
- - ✅ **IDEs** - Compatible con git manager de IntelliJ and VSCode -> mensaje de commit "auto" committea (y pushea si se quiere) con mensaje automático. Si el commit tiene problemas, se bloquea.
18
-
19
- ## 🎯 Características principales
20
-
21
- - 🔍 **Análisis de código pre-commit**: Detecta issues críticos antes de que lleguen al repo
22
- - 💬 **Mensajes de commit automáticos**: Escribe "auto" y Claude genera el mensaje con task-id (Jira, GitHub, Linear)
23
- - 📋 **Generación de PRs**: Análisis de diff y metadata automática con un comando
24
- - 🔗 **Creación de PRs en GitHub**: Claude genera metadata, Octokit crea el PR (determinista) - v2.5.0+
25
- - 🎯 **Presets por tech-stack**: 6 configuraciones optimizadas (backend, frontend, fullstack, database, ai, default) - v2.3.0+
26
- - 🚀 **Parallel Analysis**: Multiple Claude CLI processes analyzing file batches simultaneously (v2.2.0+)
27
- - 🔄 **Auto-actualización**: Se mantiene actualizado automáticamente
28
- - 🌍 **Cross-platform**: Windows, WSL, macOS, Linux sin configuración especial
29
- - ♻️ **Reintentos automáticos**: Recuperación automática de errores transitorios de API (v2.7.1+)
30
-
31
- ## 📋 CHEATSHEET
32
-
33
- ### 🚀 Comandos Frecuentes
34
-
35
- ```bash
36
- # Commit rápido sin análisis + mensaje automático
37
- git commit --no-verify -m "auto"
38
-
39
- # Analizar diferencias con origin de la rama actual
40
- claude-hooks analyze-diff
41
-
42
- # Analizar diferencias para PR (comparar con origin/develop)
43
- claude-hooks analyze-diff develop
44
-
45
- # Crear PR en GitHub con metadata automática (v2.5.0+)
46
- claude-hooks create-pr develop
47
-
48
- # Configurar token de GitHub para PRs (v2.5.0+)
49
- claude-hooks setup-github
50
-
51
- # Reinstalar durante desarrollo (después de npm link)
52
- claude-hooks install --force --skip-auth
53
-
54
- # Listar presets
55
- claude-hooks presets
56
-
57
- # Seleccionar preset
58
- claude-hooks --set-preset <name>
59
-
60
- # Mostrar preset actual
61
- claude-hooks preset current
62
-
63
- # Activar modo debug
64
- claude-hooks --debug true
65
-
66
- # Ver estado de debug
67
- claude-hooks --debug status
68
-
69
- # Ver estadísticas de telemetría (v2.9.0+, habilitada por defecto)
70
- claude-hooks telemetry show
1
+ # Claude Git Hooks
71
2
 
72
- # Limpiar datos de telemetría (v2.9.0+)
73
- claude-hooks telemetry clear
74
- ```
3
+ AI-powered git hooks for automatic commit messages, code analysis, and PR creation.
75
4
 
76
- ### 📦 Instalación y Gestión
5
+ ## Requirements
77
6
 
78
- **v2.0.0+**: Funciona terminales WSL y Bash.
7
+ - Node.js >=16.9.0
8
+ - Git
9
+ - Claude CLI (authenticated)
79
10
 
80
- Se debe instalar el paquete globalmente, para luego gestionarlo localmente en cada repositorio.
11
+ ## Quick Start
81
12
 
82
13
  ```bash
83
- # Instalar globalmente (desde cualquier terminal)
84
14
  npm install -g claude-git-hooks
85
-
86
- # Luego en cada proyecto
87
- cd /tu/proyecto
15
+ cd your-project
88
16
  claude-hooks install
89
-
90
- # Actualizar a última versión
91
- claude-hooks update
92
-
93
- # Desinstalar hooks
94
- claude-hooks uninstall
95
-
96
- # Ver estado actual
97
- claude-hooks status
98
-
99
- # Desactivar temporalmente
100
- claude-hooks disable
101
-
102
- # Reactivar hooks
103
- claude-hooks enable
104
17
  ```
105
18
 
106
- ### 💻 Flujos de Commit
107
-
108
- ```bash
109
- # Commit con análisis de código
110
- git commit -m "feat: nueva funcionalidad"
19
+ ## Usage
111
20
 
112
- # Generar mensaje automático con task-id (v2.5.0+)
113
- # Branch: feature/IX-123-add-auth → detecta IX-123
114
- git commit -m "auto"
115
- # Resultado: [IX-123] feat: add user authentication
21
+ ### Auto Commit Message
116
22
 
117
- # Branch: feature/471459f-test → NO detecta (hash, no task-id)
23
+ ```bash
118
24
  git commit -m "auto"
119
- # Resultado: feat: add test feature (sin task-id)
120
-
121
- # Saltar análisis (emergencias)
122
- git commit --no-verify -m "hotfix: corrección urgente"
123
-
124
- # Modificar último commit
125
- git commit --amend
25
+ # Claude generates message from branch name + changes
26
+ # Format: [TASK-ID] type: description
27
+ # Example: branch feature/IX-123-auth → [IX-123] feat: add authentication
126
28
  ```
127
29
 
128
- ## 🚀 Quick Setup: GitHub PR Creation
129
-
130
- Para usar `create-pr` necesitas configurar autenticación con GitHub:
131
-
132
- ### 1. Ejecuta el setup wizard
30
+ ### Create PR
133
31
 
134
32
  ```bash
135
- claude-hooks setup-github
33
+ claude-hooks create-pr develop
34
+ # Automatically pushes branch if unpublished (with confirmation)
35
+ # Analyzes diff, generates title/description, creates PR on GitHub
136
36
  ```
137
37
 
138
- El comando verificará tu token o te guiará a configurarlo.
139
-
140
- ### 2. Opciones de configuración del token
38
+ **Auto-push feature (v2.11.0):**
39
+ - Detects unpublished branches or unpushed commits
40
+ - Shows commit preview before pushing
41
+ - Prompts for confirmation (configurable)
42
+ - Handles diverged branches gracefully
141
43
 
142
- **Opción A - Settings local (recomendado):**
44
+ ### GitHub Token Setup
143
45
 
144
46
  ```bash
145
- # Crear .claude/settings.local.json
146
- cat > .claude/settings.local.json << 'EOF'
147
- {
148
- "githubToken": "ghp_tu_token_aqui"
149
- }
150
- EOF
47
+ claude-hooks setup-github # Shows status and configuration options
151
48
  ```
152
49
 
153
- **Opción B - Variable de entorno:**
154
-
155
- ```bash
156
- export GITHUB_TOKEN="ghp_tu_token_aqui"
157
- # o
158
- export GITHUB_PERSONAL_ACCESS_TOKEN="ghp_tu_token_aqui"
50
+ **Option 1 - Settings file (recommended):**
51
+ ```json
52
+ // .claude/settings.local.json (gitignored)
53
+ { "githubToken": "ghp_..." }
159
54
  ```
160
55
 
161
- **Opción C - Claude Desktop config** (auto-detectado si existe)
162
-
163
- ### 3. Crear GitHub token
164
-
165
- 1. Ir a https://github.com/settings/tokens
166
- 2. "Generate new token (classic)"
167
- 3. Scopes requeridos: **repo** (all) + **read:org**
168
- 4. Copiar token (empieza con `ghp_`)
169
-
170
- ### 4. Configurar reviewers y labels (opcional)
171
-
56
+ **Option 2 - Environment variable:**
172
57
  ```bash
173
- # Ver .claude/config_example/ para más ejemplos
174
- cat > .claude/config.json << 'EOF'
175
- {
176
- "version": "2.8.0",
177
- "preset": "backend",
178
- "overrides": {
179
- "github": {
180
- "pr": {
181
- "defaultBase": "develop",
182
- "reviewers": ["tu-usuario-github", "teammate"],
183
- "labelRules": {
184
- "backend": ["backend", "java"],
185
- "frontend": ["frontend", "react"]
186
- }
187
- }
188
- }
189
- }
190
- }
191
- EOF
58
+ export GITHUB_TOKEN="ghp_..."
192
59
  ```
193
60
 
194
- **Nota:** Los reviewers también se detectan automáticamente desde CODEOWNERS si existe.
61
+ Create token at https://github.com/settings/tokens with scopes: `repo`, `read:org`
195
62
 
196
- ### 5. Crear tu primer PR
63
+ ### Analyze Diff (without creating PR)
197
64
 
198
65
  ```bash
199
- git checkout -b feature/mi-feature
200
- # ... hacer cambios ...
201
- git add .
202
- git commit -m "feat: nueva funcionalidad"
203
- git push -u origin feature/mi-feature
204
-
205
- # Crear PR
206
- claude-hooks create-pr develop
66
+ claude-hooks analyze-diff develop
67
+ # Generates PR metadata without creating
207
68
  ```
208
69
 
209
- **Arquitectura:** Claude analiza el diff y genera metadata (título, descripción, reviewers, labels) → Octokit crea el PR de forma determinista.
210
-
211
- Ver `templates/config.github.example.json` para configuración avanzada (reviewer rules por path, custom labels, etc.).
212
-
213
- ---
214
-
215
- ## 📆 Próximos Desarrollos
216
-
217
- Toda idea es bienvenida, aunque parezca espantosa. Si hay bugs, incluirlos también. Dónde? en https://github.com/mscope-S-L/git-hooks/issues/new.
218
-
219
- ### 🔧 Configuración Avanzada (v2.8.0+)
70
+ ### Disable/Enable Hooks
220
71
 
221
72
  ```bash
222
- # Configuración vía .claude/config.json (v2.8.0+)
223
- .claude/
224
- ├── config.json # Configuración principal (formato simplificado)
225
- ├── config_example/ # Ejemplos de configuración
226
- │ ├── config.example.json # Configuración básica
227
- │ └── config.advanced.example.json # Parámetros avanzados
228
- └── prompts/ # Templates de prompts (v2.8.0+)
229
- ├── CLAUDE_PRE_COMMIT.md # Criterios de análisis
230
- └── CLAUDE_ANALYSIS_PROMPT.md # Template del prompt
231
-
232
- # Ejemplo de config.json v2.8.0 (formato simplificado)
233
- cat > .claude/config.json << 'EOF'
234
- {
235
- "version": "2.8.0",
236
- "preset": "backend",
237
- "overrides": {
238
- "github": {
239
- "pr": {
240
- "defaultBase": "main",
241
- "reviewers": ["tech-lead"]
242
- }
243
- },
244
- "subagents": {
245
- "batchSize": 2
246
- }
247
- }
248
- }
249
- EOF
250
-
251
- # Para configuración avanzada, consultar:
252
- # .claude/config_example/config.advanced.example.json
253
-
254
- # Personalizar patrón de task-id
255
- # Default: 1-3 letras + separador + 3-5 dígitos
256
- # Ejemplos válidos: ABC-12345, IX-123, DE 4567
257
- # No detecta: 471459f (hash), ABCD-123 (4 letras), IX-12 (2 dígitos)
73
+ claude-hooks disable [pre-commit|prepare-commit-msg]
74
+ claude-hooks enable [pre-commit|prepare-commit-msg]
258
75
  ```
259
76
 
260
- #### 🎯 Presets Disponibles
261
-
262
- | Preset | Extensiones de Archivo | Caso de Uso | Tech Stack |
263
- | ------------- | -------------------------------------------------------------------------- | ----------------- | ---------------------------- |
264
- | **backend** | `.java`, `.xml`, `.yml`, `.yaml` | APIs Spring Boot | Spring Boot, JPA, SQL Server |
265
- | **frontend** | `.js`, `.jsx`, `.ts`, `.tsx`, `.css`, `.scss`, `.html` | Apps React | React, Redux, Material-UI |
266
- | **fullstack** | Todos backend + frontend | Apps full-stack | Spring Boot + React |
267
- | **database** | `.sql` | Scripts de BD | SQL Server, T-SQL |
268
- | **ai** | `.js`, `.json`, `.md`, `.sh` | Herramientas CLI | Node.js, Claude API |
269
- | **default** | `.js`, `.sh`, `.py`, `.rb`, `.pl`, `.sql`, `.yaml`, `.json`, `.xml`, `.md` | Propósito general | Lenguajes mixtos |
270
-
271
- ---
272
-
273
- #### 🔍 Qué Verifica Cada Preset
274
-
275
- **Backend (Spring Boot + SQL Server)**
276
-
277
- - ✅ Diseño de API REST y métodos HTTP
278
- - ✅ Entidades JPA y repositorios
279
- - ✅ Seguridad (OWASP Top 10)
280
- - ✅ Prevención de inyección SQL
281
- - ✅ Gestión de transacciones
282
- - ✅ Mapeos DTO
283
- - ✅ Mejores prácticas Spring Security
284
-
285
- **Frontend (React + Material-UI)**
286
-
287
- - ✅ Mejores prácticas de hooks React
288
- - ✅ Diseño de componentes y reusabilidad
289
- - ✅ Patrones de gestión de estado
290
- - ✅ Prevención XSS
291
- - ✅ Optimización de rendimiento
292
- - ✅ Accesibilidad (a11y)
293
- - ✅ Error boundaries
294
-
295
- **Fullstack (Spring Boot + React)**
296
-
297
- - ✅ **Consistencia de contrato API** (prioridad)
298
- - ✅ Flujo de datos (BD → API → UI)
299
- - ✅ Autenticación entre capas
300
- - ✅ Consistencia en manejo de errores
301
- - ✅ Todas las verificaciones backend
302
- - ✅ Todas las verificaciones frontend
303
-
304
- **Database (SQL Server)**
305
-
306
- - ✅ Riesgos de inyección SQL
307
- - ✅ UPDATE/DELETE sin WHERE
308
- - ✅ Índices faltantes
309
- - ✅ Rendimiento de consultas
310
- - ✅ Manejo de transacciones
311
- - ✅ Restricciones de integridad de datos
312
-
313
- **AI (Node.js + Claude)**
314
-
315
- - ✅ Mejores prácticas Claude API
316
- - ✅ Calidad de ingeniería de prompts
317
- - ✅ Experiencia de usuario CLI
318
- - ✅ Seguridad de operaciones Git
319
- - ✅ Compatibilidad multiplataforma
320
- - ✅ Protección de API key
321
-
322
- **Default (Propósito general)**
323
-
324
- - ✅ Fundamentos de calidad de código
325
- - ✅ Fundamentos de seguridad
326
- - ✅ Manejo de errores
327
- - ✅ Mejores prácticas por lenguaje
328
- - ✅ Mantenibilidad
329
-
330
- ---
331
-
332
- ##### ⚙️ Prioridad de Configuración
333
-
334
- ```
335
- defaults (lib/config.js)
336
-
337
- user config (.claude/config.json) ← General preferences
338
-
339
- preset config (.claude/presets/{name}/config.json) ← MÁXIMA PRIORIDAD (tech-stack specific)
340
- ```
341
-
342
- **Rationale**: User sets general preferences, preset provides tech-stack-specific overrides.
343
-
344
- **Nota v2.2.0+:** Variables de entorno ya NO son soportadas. Usar `.claude/config.json` en su lugar.
345
-
346
- ### 🎯 Casos de Uso Específicos
77
+ ### Uninstall
347
78
 
348
79
  ```bash
349
- # Desarrollo local de claude-hooks
350
- cd /path/to/claude-git-hooks
351
- npm link
352
- cd /path/to/your-project
353
- claude-hooks install --force --skip-auth
354
-
355
- # Preparar PR hacia develop
356
- git checkout -b feature/nueva-funcionalidad
357
- # ... hacer cambios ...
358
- git add .
359
- git commit -m "feat: implementar nueva funcionalidad"
360
- claude-hooks analyze-diff develop # Genera título, descripción y tests
361
-
362
- # Resolver issues bloqueantes
363
- git commit -m "fix: resolver issues"
364
- # Si falla, ver claude_resolution_prompt.md generado
365
- # Copiar contenido y pegar en Claude para obtener solución
80
+ claude-hooks uninstall
366
81
  ```
367
82
 
368
- ### ⚡ Tips y Trucos
369
-
370
- 1. **Mensaje automático**: Usa `"auto"` como mensaje para que Claude lo genere con task-id automático
371
- 2. **Task-ID pattern**: Default 1-3 letras + separador + 3-5 dígitos (ABC-12345, IX-123). Configurable en `.claude/config_example/config.advanced.example.json`
372
- 3. **Skip auth**: Usa `--skip-auth` en CI/CD o desarrollo local
373
- 4. **Force install**: Usa `--force` para reinstalar sin confirmación
374
- 5. **Debug**: Activa con `claude-hooks --debug true`
375
- 6. **Archivos grandes**: Se omiten automáticamente archivos > 1MB (hardcoded desde v2.8.0)
376
- 7. **Límite de archivos**: Máximo 20 archivos por commit (hardcoded desde v2.8.0)
377
-
378
- ### 🚀 Parallel Analysis (Enabled by default desde v2.8.0)
379
-
380
- **When analyzing 3+ files**, parallel execution runs multiple Claude CLI processes simultaneously for faster analysis.
381
-
382
- **Configuración automática (hardcoded):**
383
- - ✅ **Enabled**: `true` (siempre activo)
384
- - ⚡ **Model**: `haiku` (rápido y económico)
385
- - 📦 **BatchSize**: `3` files per batch (puede overridearse)
386
-
387
- **Customizar batch size (opcional):**
83
+ ### Presets
388
84
 
389
85
  ```bash
390
- # En .claude/config.json v2.8.0
391
- {
392
- "version": "2.8.0",
393
- "preset": "backend",
394
- "overrides": {
395
- "subagents": {
396
- "batchSize": 2
397
- }
398
- }
399
- }
400
- ```
401
-
402
- **Model options (solo en config avanzado):**
403
-
404
- - `haiku` - Fast & cheap (default)
405
- - `sonnet` - Balanced quality/speed
406
- - `opus` - Maximum quality (slower)
407
-
408
- **How batching works:**
409
-
410
- - Files are split into batches of size `batchSize`
411
- - Each batch runs in a separate Claude CLI process
412
- - All batches execute in parallel (true OS-level parallelism)
413
- - Results are consolidated automatically
414
-
415
- **Examples with 4 files:**
416
-
417
- - `batchSize: 1` → 4 parallel Claude processes (1 file each) - **fastest**
418
- - `batchSize: 2` → 2 parallel Claude processes (2 files each) - **balanced**
419
- - `batchSize: 4` → 1 process (all files) - no parallelization
420
-
421
- **Speed improvement:**
422
-
423
- - Sequential: 60s per file × 4 = 240s total
424
- - Parallel (batch=1): max(60s) = 60s total ✅ **4x faster**
425
-
426
- **Console output:**
427
-
86
+ claude-hooks presets # List available
87
+ claude-hooks --set-preset backend # Set preset
88
+ claude-hooks preset current # Show current
428
89
  ```
429
- 🚀 PARALLEL EXECUTION: 4 Claude processes
430
- ⚡ Launching batch 1/4...
431
- ⚡ Launching batch 2/4...
432
- ⚡ Launching batch 3/4...
433
- ⚡ Launching batch 4/4...
434
- ⏳ Waiting for all batches to complete...
435
-
436
- ✅ PARALLEL EXECUTION COMPLETE: 4 results in 62.5s
437
- ```
438
-
439
- **Best for:** Large commits (3+ files), refactoring, multi-file features
440
-
441
- ### 🎨 Personalización y Customización
442
-
443
- **Archivos clave para modificar:**
444
90
 
445
- - `.claude/config.json` - Configuración principal (v2.8.0+)
446
- - `.claude/prompts/CLAUDE_PRE_COMMIT.md` - Criterios (backend/frontend/data/db)
447
- - `.claude/prompts/CLAUDE_ANALYSIS_PROMPT.md` - Template del prompt
91
+ | Preset | Extensions | Focus |
92
+ |--------|------------|-------|
93
+ | backend | .java, .xml, .yml, .yaml | Spring Boot, JPA, OWASP |
94
+ | frontend | .js, .jsx, .ts, .tsx, .css, .scss, .html | React, XSS, a11y |
95
+ | fullstack | all above | API contract consistency |
96
+ | database | .sql | SQL injection, indexes |
97
+ | ai | .js, .json, .md, .sh | Node.js, Claude API |
98
+ | default | multiple | General quality |
448
99
 
449
- **Crear o modificar presets personalizados:**
100
+ ### Skip Analysis
450
101
 
451
102
  ```bash
452
- # Ver guía completa de customización
453
- cat templates/CUSTOMIZATION_GUIDE.md
454
-
455
- # O en GitHub
456
- # https://github.com/pablorovito/claude-git-hooks/blob/main/templates/CUSTOMIZATION_GUIDE.md
103
+ git commit --no-verify -m "message"
457
104
  ```
458
105
 
459
- **Ejemplo:**
106
+ ### Debug Mode
460
107
 
461
108
  ```bash
462
- vim .claude/prompts/CLAUDE_PRE_COMMIT.md # Agregar reglas API REST/Spring Boot
109
+ claude-hooks --debug true|false|status
463
110
  ```
464
111
 
465
- ## 🔧 Configuración Previa Importante
466
-
467
- ### Requisitos del Sistema
468
-
469
- ✨ **v2.0.0+**: Los hooks funcionan en cualquier terminal donde tengas:
470
-
471
- - **Node.js** >= 16.9.0
472
- - **Git** configurado
473
- - **Claude CLI** instalado y autenticado
474
-
475
- 🆕 **v2.6.0+**: Totalmente compatible con Node.js 24
476
-
477
- ### Credenciales Git
478
-
479
- Si es tu primera vez configurando git en esta terminal, configura tus credenciales:
112
+ ### Telemetry
480
113
 
481
114
  ```bash
482
- git config --global user.name "Tu Nombre"
483
- git config --global user.email "tu.email@ejemplo.com"
484
-
485
- # Si usas credential helper (opcional)
486
- git config --global credential.helper store
115
+ claude-hooks telemetry show # View statistics
116
+ claude-hooks telemetry clear # Clear data
487
117
  ```
488
118
 
489
- ## 🚀 Instalación
490
-
491
- ✨ **v2.0.0+**: Instalación cross-platform. Funciona en PowerShell, CMD, WSL, macOS Terminal, Linux shell.
119
+ ### Other Commands
492
120
 
493
121
  ```bash
494
- # Instalar el paquete globalmente
495
- npm install -g claude-git-hooks
496
-
497
- # En cualquier repositorio, instalar los hooks
498
- cd tu-proyecto
499
- claude-hooks install
122
+ claude-hooks status # Show hook status
123
+ claude-hooks update # Update to latest version
124
+ claude-hooks --help # Full command reference
500
125
  ```
501
126
 
502
- El comando `claude-hooks install` incluye:
503
-
504
- - ✅ Verificación completa de dependencias del sistema (Node.js, Git, Claude CLI)
505
- - ✅ Verificación de autenticación Claude con entretenimiento (omitible con `--skip-auth`)
506
- - ✅ Instalación de hooks con arquitectura bash wrapper + Node.js
507
- - ✅ Instalación de archivos de pautas y templates
508
- - ✅ Actualización automática de .gitignore con archivos de Claude
509
-
510
- **Nuevo en v2.0.0 - Soporte Cross-Platform:**
511
-
512
- Auto-detecta plataforma, convierte CRLF→LF en install, busca Claude en WSL (Windows), instala bash wrappers que convierten rutas C:\ a /c/
513
-
514
- **Opciones de instalación:**
515
-
516
- - `--force`: Reinstala aunque los hooks ya existan
517
- - `--skip-auth`: Omite la verificación de autenticación de Claude (útil para CI/CD)
518
-
519
- ## 📁 Gestión de Archivos
520
-
521
- ### Archivos creados durante la instalación
522
-
523
- El comando `claude-hooks install` crea los siguientes archivos y directorios:
524
-
525
- 1. **`.git/hooks/pre-commit`** - Hook de análisis de código
526
- 2. **`.git/hooks/prepare-commit-msg`** - Hook de generación de mensajes
527
- 3. **`.git/hooks/check-version.sh`** - Script de verificación de versión
528
- 4. **`.claude/`** - Directorio para archivos de configuración
529
- - `CLAUDE_PRE_COMMIT.md` - Criterios de evaluación de calidad
530
- - `CLAUDE_ANALYSIS_PROMPT.md` - Template de prompt para análisis
531
- - `CLAUDE_RESOLUTION_PROMPT.md` - Template para prompt de resolución AI
532
-
533
- ### Actualización automática de .gitignore
127
+ ---
534
128
 
535
- Durante la instalación, Claude Hooks actualiza automáticamente tu `.gitignore` para incluir:
129
+ ## Architecture Reference (AI Context)
130
+
131
+ ### Design Philosophy
132
+
133
+ **Modular, decoupled, reusable code.** Each component has a single responsibility and can be tested/modified independently.
134
+
135
+ ### Directory Map
136
+
137
+ | Path | Purpose | Key Exports |
138
+ |------|---------|-------------|
139
+ | `bin/claude-hooks` | **Thin CLI router** - argument parsing, command dispatch | - |
140
+ | `lib/commands/` | **Command modules** - one file per CLI command | See table below |
141
+ | `lib/config.js` | **Config system** - load/merge configuration | `getConfig()` |
142
+ | `lib/hooks/` | **Git hook logic** - Node.js implementations | `pre-commit.js`, `prepare-commit-msg.js` |
143
+ | `lib/utils/` | **Reusable utilities** - shared across commands | See table below |
144
+ | `templates/` | **Static assets** - bash wrappers, prompts, presets | Copied during install |
145
+
146
+ ### Command Modules (`lib/commands/`)
147
+
148
+ | Module | Purpose | Key Exports |
149
+ |--------|---------|-------------|
150
+ | `helpers.js` | **Shared CLI utilities** - colors, output, platform detection | `colors`, `error()`, `success()`, `info()`, `checkGitRepo()`, `Entertainment` |
151
+ | `install.js` | **Installation logic** - dependencies, hooks, templates | `runInstall()`, `extractLegacySettings()` |
152
+ | `hooks.js` | **Hook management** - enable, disable, status, uninstall | `runEnable()`, `runDisable()`, `runStatus()`, `runUninstall()` |
153
+ | `analyze-diff.js` | **Diff analysis** - generate PR metadata from git diff | `runAnalyzeDiff()` |
154
+ | `create-pr.js` | **PR creation** - full workflow via Octokit | `runCreatePr()` |
155
+ | `setup-github.js` | **Token setup** - interactive GitHub configuration | `runSetupGitHub()` |
156
+ | `presets.js` | **Preset management** - list, set, show current | `runShowPresets()`, `runSetPreset()`, `runCurrentPreset()` |
157
+ | `update.js` | **Self-update** - check and install latest version | `runUpdate()` |
158
+ | `migrate-config.js` | **Config migration** - legacy to v2.8.0 format | `runMigrateConfig()` |
159
+ | `debug.js` | **Debug toggle** - enable/disable verbose logging | `runSetDebug()` |
160
+ | `telemetry-cmd.js` | **Telemetry commands** - show/clear statistics | `runShowTelemetry()`, `runClearTelemetry()` |
161
+ | `help.js` | **Help display** - usage information | `runShowHelp()`, `runShowVersion()` |
162
+
163
+ ### Utility Modules (`lib/utils/`)
164
+
165
+ | Module | Purpose | Key Exports |
166
+ |--------|---------|-------------|
167
+ | `claude-client.js` | **Claude CLI wrapper** - spawn, retry, parallel execution | `analyzeCode()`, `analyzeCodeParallel()`, `executeClaudeWithRetry()` |
168
+ | `prompt-builder.js` | **Prompt construction** - load templates, replace variables | `buildAnalysisPrompt()`, `loadPrompt()` |
169
+ | `git-operations.js` | **Git abstractions** - staged files, diff, repo root | `getStagedFiles()`, `getDiff()`, `getRepoRoot()` |
170
+ | `github-api.js` | **Octokit integration** - PR creation, token validation | `createPullRequest()`, `validateToken()`, `saveGitHubToken()` |
171
+ | `github-client.js` | **GitHub helpers** - CODEOWNERS parsing, reviewers | `getReviewersForFiles()`, `parseGitHubRepo()` |
172
+ | `preset-loader.js` | **Preset system** - load tech-stack configurations | `loadPreset()`, `listPresets()` |
173
+ | `task-id.js` | **Task ID extraction** - Jira, GitHub, Linear patterns | `getOrPromptTaskId()`, `formatWithTaskId()` |
174
+ | `resolution-prompt.js` | **Issue resolution** - AI-friendly fix prompts | `generateResolutionPrompt()` |
175
+ | `logger.js` | **Logging system** - centralized output with debug mode | `info()`, `warning()`, `error()`, `debug()` |
176
+ | `interactive-ui.js` | **CLI UI components** - previews, prompts, spinners | `showPRPreview()`, `promptConfirmation()`, `promptMenu()` |
177
+ | `telemetry.js` | **Local telemetry** - track JSON parsing, retries | `recordEvent()`, `displayStatistics()` |
178
+
179
+ ### Execution Flow
180
+
181
+ #### Pre-commit Hook
536
182
 
537
- ```gitignore
538
- # Claude Git Hooks
539
- .claude/
540
183
  ```
541
-
542
- Esto asegura que:
543
-
544
- - Los archivos de configuración de Claude específicos del proyecto no se suban al repositorio
545
- - Los archivos de debug temporales se ignoren
546
- - Cada desarrollador pueda tener sus propias preferencias de análisis
547
-
548
- Si no existe un `.gitignore`, se creará uno nuevo. Si ya existe, las entradas se agregarán al final solo si no están presentes.
549
-
550
- ## 🎯 Funcionamiento
551
-
552
- ### Hook pre-commit (Análisis de código)
553
-
554
- 1. **Intercepta cada intento de commit**
555
- 2. **Extrae y filtra archivos modificados**:
556
- - Solo analiza: Java, XML, properties, yml, yaml
557
- - Omite archivos mayores a 1MB
558
- - Límite de 30 archivos por commit
559
- 3. **Construye prompt inteligente**:
560
- - Usa template de prompt desde `.claude/prompts/CLAUDE_ANALYSIS_PROMPT*.md`
561
- - Lee las pautas desde `.claude/prompts/CLAUDE_PRE_COMMIT*.md`
562
- - Incluye el diff completo para archivos nuevos
563
- - Muestra solo cambios para archivos existentes
564
- 4. **Envía a Claude CLI para revisión**
565
- 5. **Procesa respuesta JSON estructurada**:
566
- - blockingIssues siempre como objetos con localización precisa
567
- - verifica `QUALITY_GATE`, muestra métricas y issues por severidad
568
- 6. **Decisión final**:
569
- - Si hay problemas críticos → genera prompt AI de resolución y bloquea commit
570
- - Si todo está bien → commit procede
571
- 7. **Generación de Prompt de Resolución AI** (opcional): Cuando se detectan problemas críticos:
572
-
573
- - Se genera automáticamente un archivo `claude_resolution_prompt.md`
574
- - Contiene información estructurada y AI-friendly de todos los issues
575
- - Incluye localización precisa (archivo, línea, método)
576
- - Puede copiarse a otra instancia de Claude para resolución automática
577
-
578
- ### Hook prepare-commit-msg (Generación automática de mensajes)
579
-
580
- 1. **Se activa cuando el mensaje es**:
581
- - `"auto"`
582
- 2. **Analiza los cambios del staging area**:
583
- - Lista archivos modificados con estadísticas
584
- - Incluye diffs completos para archivos < 1MB
585
- 3. **Genera mensaje en formato Conventional Commits**:
586
- - Determina tipo: feat, fix, docs, style, refactor, test, chore
587
- - Crea título conciso y descriptivo
588
- - Añade body con detalles si es necesario
589
- 4. **Manejo de errores**:
590
- - Si falla la generación → cancela el commit completamente
591
- - No usa mensajes genéricos de fallback
592
-
593
- ### Características adicionales
594
-
595
- - **Generación de información para Pull Requests**: `claude-hooks analyze-diff [branch]` para comparar rama local con rama origin, propone nombre para rama actual, título y detalles para pull request, da tips para verificar trabajo. Si se especifica branch, compara con origin/branch. Si no, compara con origin de la rama actual. Este comando genera automáticamente:
596
- - 📝 Título de PR conciso (máx. 72 caracteres)
597
- - 📄 Descripción detallada con markdown
598
- - 🌿 Nombre de rama sugerido (formato: tipo/descripcion)
599
- - 📋 Tipo de cambio (feature/fix/refactor/docs/test/chore)
600
- - ⚠️ Indicador de breaking changes
601
- - 🧪 Notas de testing recomendado
602
- - 📝 Archivo `.claude-pr-analysis.json`
603
- - **Creación de PRs en GitHub (v2.5.0+)**: `claude-hooks create-pr [branch]` crea pull requests directamente en GitHub vía MCP. Extrae task-id de branch, genera metadata con Claude, detecta reviewers desde CODEOWNERS o config, aplica labels por preset, y muestra preview interactivo antes de crear
604
- - **Auto-actualización**: Verificación automática de versiones antes de cada commit con prompt interactivo para actualizar
605
- - **Comando update**: `claude-hooks update` para actualizar manualmente a la última versión
606
- - **Modo debug**: `claude-hooks --debug true` activa logging detallado para troubleshooting
607
- - **Análisis de PR**: Nuevo comando `analyze-diff` para generar información de Pull Requests
608
- - **Validación de dependencias**: Verifica que Claude CLI esté autenticado antes de ejecutar
609
-
610
- ### Desactivar/Activar hooks
611
-
612
- ```bash
613
- # Desactivar todos los hooks
614
- claude-hooks disable
615
-
616
- # Desactivar un hook específico
617
- claude-hooks disable pre-commit
618
- claude-hooks disable prepare-commit-msg
619
-
620
- # Habilitar todos los hooks
621
- claude-hooks enable
622
-
623
- # Habilitar un hook específico
624
- claude-hooks enable pre-commit
625
- claude-hooks enable prepare-commit-msg
626
-
627
- # Ver estado actual
628
- claude-hooks status
184
+ git commit → templates/pre-commit (bash wrapper)
185
+ lib/hooks/pre-commit.js
186
+ → getStagedFiles() → filter by preset extensions
187
+ buildAnalysisPrompt() analyzeCode() or analyzeCodeParallel()
188
+ parse JSON response exit 0 (pass) or exit 1 (block)
189
+ if blocked: generates claude_resolution_prompt.md
629
190
  ```
630
191
 
631
- ## ⚙️ Configuración
632
-
633
- ### Scripts
634
-
635
- ✨ **v2.0.0+**: Configuración en archivos Node.js dentro de `lib/hooks/`.
636
-
637
- En `lib/hooks/pre-commit.js`:
638
-
639
- - **`MAX_FILE_SIZE`**: Tamaño máximo de archivo a analizar (default: 1MB)
640
- - **`MAX_FILES`**: Número máximo de archivos por commit (default: 30)
641
- - **`ALLOWED_EXTENSIONS`**: Extensiones permitidas (default: .java, .xml, .properties, .yml, .yaml)
642
-
643
- En `lib/hooks/prepare-commit-msg.js`:
644
-
645
- - **`MAX_FILE_SIZE`**: Tamaño máximo para incluir diff completo (default: 1MB)
646
-
647
- ### Pautas de Evaluación
648
-
649
- - **`CLAUDE_PRE_COMMIT.md`** - Criterios de evaluación de calidad
650
-
651
- ### Templates de Prompts
652
-
653
- - **`CLAUDE_ANALYSIS_PROMPT.md`** - Estructura del prompt de análisis
654
- - **`CLAUDE_RESOLUTION_PROMPT.md`** - Template para generar prompts de resolución
655
-
656
- Todos estos archivos son personalizables y específicos de tu proyecto. Puedes:
657
-
658
- - Modificar los criterios de evaluación según estándares del equipo
659
- - Ajustar la estructura de los prompts para obtener respuestas más precisas
660
- - Personalizar el formato de salida del prompt de resolución
661
-
662
- ## 🐛 Troubleshooting
192
+ #### Commit Message Generation
663
193
 
664
- No hay... esto es la perfección hecha código.
665
-
666
- ## 🔧 Desarrollo y Contribución
667
-
668
- ### Estructura del Proyecto
669
-
670
- ✨ **v2.0.0+**: Nueva arquitectura modular con ES6 modules.
671
-
672
- ```
673
- claude-git-hooks/
674
- ├── bin/
675
- │ └── claude-hooks # CLI principal (ES6 modules)
676
- ├── lib/ # 🆕 Código Node.js modular
677
- │ ├── config.js # Configuración centralizada con merge
678
- │ ├── hooks/
679
- │ │ ├── pre-commit.js # Hook de análisis (Node.js)
680
- │ │ └── prepare-commit-msg.js # Hook de mensajes (Node.js)
681
- │ └── utils/
682
- │ ├── logger.js # Sistema de logging centralizado
683
- │ ├── git-operations.js # Operaciones git abstractas
684
- │ ├── file-utils.js # Utilidades de sistema de archivos
685
- │ ├── claude-client.js # Cliente Claude CLI
686
- │ ├── prompt-builder.js # Constructor de prompts
687
- │ ├── resolution-prompt.js # Generador de resolution prompts
688
- │ ├── preset-loader.js # Cargador de presets
689
- │ ├── installation-diagnostics.js # Diagnósticos de instalación
690
- │ ├── claude-diagnostics.js # Diagnósticos de errores Claude CLI
691
- │ ├── github-api.js # 🆕 Integración Octokit (determinista)
692
- │ ├── github-client.js # Cliente GitHub (CODEOWNERS, reviewers)
693
- │ ├── task-id.js # Extracción task-id (Jira, GitHub, Linear)
694
- │ ├── interactive-ui.js # UI interactiva CLI (preview, prompts)
695
- │ └── mcp-setup.js # Setup y detección MCP
696
- ├── templates/
697
- │ ├── pre-commit # Bash wrapper (llama a lib/hooks/pre-commit.js)
698
- │ ├── prepare-commit-msg # Bash wrapper (llama a lib/hooks/prepare-commit-msg.js)
699
- │ ├── check-version.sh # Script de verificación de versión
700
- │ ├── CLAUDE_PRE_COMMIT.md # Criterios de evaluación
701
- │ ├── CLAUDE_ANALYSIS_PROMPT.md # Template de prompt para análisis
702
- │ ├── CLAUDE_RESOLUTION_PROMPT.md # Template para resolución de issues
703
- │ ├── ANALYZE_DIFF.md # Template para análisis de diff (PR metadata)
704
- │ ├── CREATE_GITHUB_PR.md # Template para creación de PR
705
- │ ├── config.github.example.json # 🆕 Ejemplo configuración GitHub
706
- │ └── settings.local.example.json # 🆕 Ejemplo token local (gitignored)
707
- ├── test/ # 🆕 Tests unitarios con Jest
708
- │ └── unit/
709
- │ └── logger.test.js # Tests del logger
710
- ├── .claude/ # Directorio de configuración local (gitignore)
711
- │ └── settings.local.json # Configuración local del usuario
712
- ├── jest.config.js # 🆕 Configuración Jest para ES6
713
- ├── .eslintrc.json # 🆕 Configuración ESLint
714
- ├── .prettierrc.json # 🆕 Configuración Prettier
715
- ├── package.json # Configuración NPM (type: "module")
716
- ├── package-lock.json # Lock file de NPM
717
- ├── README.md # Este archivo
718
- ├── CHANGELOG.md # Historial de versiones
719
- └── .gitignore # Archivos ignorados por git
720
194
  ```
721
-
722
- ### 🔌 Utility Modules Reference
723
-
724
- **Purpose**: Reusable modules for extending claude-hooks or building similar tools
725
-
726
- #### Core Utilities
727
-
728
- | Module | Purpose | Key Exports | Usage Context |
729
- | --------------------------------- | ------------------------------------- | ------------------------------------------------- | ---------------------------------------------- |
730
- | **`config.js`** | Centralized configuration management | `getConfig()`, `defaults` | Priority merging: defaults < user < preset |
731
- | **`logger.js`** | Structured logging with debug support | `info()`, `warning()`, `error()`, `debug()` | Console output with context tracking |
732
- | **`git-operations.js`** | Git command abstractions | `getRepoRoot()`, `getStagedFiles()`, `getDiff()` | Safe git operations with error handling |
733
- | **`file-utils.js`** | File system operations | `ensureDir()`, `writeFile()` | Repo-root-relative path handling |
734
- | **`claude-client.js`** | Claude CLI integration | `analyzeCode()`, `analyzeCodeParallel()` | Prompt execution with timeout/retry |
735
- | **`prompt-builder.js`** | Template-based prompts | `buildAnalysisPrompt()`, `loadTemplate()` | Dynamic prompt construction from .md files |
736
- | **`preset-loader.js`** | Preset system | `loadPreset()`, `listPresets()`, `loadTemplate()` | Metadata, config, template loading |
737
- | **`resolution-prompt.js`** | Issue resolution prompts | `generateResolutionPrompt()` | AI-friendly error remediation prompts |
738
- | **`installation-diagnostics.js`** | Installation error diagnostics | `formatError()`, `getInstallationDiagnostics()` | Installation error formatting with remediation |
739
- | **`claude-diagnostics.js`** | Claude CLI error diagnostics | `detectClaudeError()`, `formatClaudeError()` | Rate limit, auth, network error detection |
740
- | **`github-api.js`** | Octokit GitHub integration | `createPullRequest()`, `readCodeowners()` | Deterministic PR creation, token resolution |
741
- | **`github-client.js`** | GitHub operations | `getReviewersForFiles()`, `parseGitHubRepo()` | CODEOWNERS parsing, reviewer detection |
742
- | **`task-id.js`** | Task ID extraction | `getOrPromptTaskId()`, `formatWithTaskId()` | Jira, GitHub, Linear task-id extraction |
743
- | **`interactive-ui.js`** | Interactive CLI components | `showPRPreview()`, `promptConfirmation()` | Terminal UI helpers (spinners, menus) |
744
- | **`mcp-setup.js`** | MCP detection and setup | `findGitHubTokenInDesktopConfig()` | Claude Desktop config token resolution |
745
-
746
- #### Using Utilities in Other Claude Instances
747
-
748
- **Example: Check installation health**
749
-
750
- ```javascript
751
- import { formatError } from './lib/utils/installation-diagnostics.js';
752
-
753
- try {
754
- // ... operation that may fail
755
- } catch (error) {
756
- console.error(formatError('Operation failed', ['Additional context line']));
757
- process.exit(1);
758
- }
195
+ git commit -m "auto" → templates/prepare-commit-msg (bash wrapper)
196
+ lib/hooks/prepare-commit-msg.js
197
+ → extract task-id from branch name
198
+ generate message via Claude
199
+ → write to COMMIT_EDITMSG
759
200
  ```
760
201
 
761
- **Example: Load configuration**
202
+ #### PR Creation
762
203
 
763
- ```javascript
764
- import { getConfig } from './lib/config.js';
765
-
766
- const config = await getConfig();
767
- const maxFiles = config.analysis.maxFiles;
768
204
  ```
769
-
770
- **Example: Execute git operations**
771
-
772
- ```javascript
773
- import { getRepoRoot, getStagedFiles } from './lib/utils/git-operations.js';
774
-
775
- const repoRoot = getRepoRoot();
776
- const files = getStagedFiles({ extensions: ['.js', '.ts'] });
205
+ claude-hooks create-pr → bin/claude-hooks (router)
206
+ lib/commands/create-pr.js
207
+ → validateToken() (github-api.js)
208
+ → parseGitHubRepo() (github-client.js)
209
+ getReviewersForFiles() (CODEOWNERS + config)
210
+ → executeClaudeWithRetry() (metadata generation)
211
+ createPullRequest() (Octokit API)
777
212
  ```
778
213
 
779
- **Example: Build custom prompts**
780
-
781
- ```javascript
782
- import { buildAnalysisPrompt } from './lib/utils/prompt-builder.js';
214
+ ### Config Priority
783
215
 
784
- const prompt = await buildAnalysisPrompt({
785
- templateName: 'CUSTOM_PROMPT.md',
786
- files: filesData,
787
- metadata: { REPO_NAME: 'my-repo' }
788
- });
216
+ ```
217
+ defaults (lib/config.js)
218
+ < user config (.claude/config.json)
219
+ < preset config (.claude/presets/{name}/)
789
220
  ```
790
221
 
791
- **Note**: All utilities follow single-responsibility principle and include JSDoc documentation inline.
792
-
793
- ### Configuración del Entorno de Desarrollo
794
-
795
- ```bash
796
- # 1. Clonar el repositorio
797
- git clone https://github.com/pablorovito/claude-git-hooks.git
798
- cd claude-git-hooks
799
-
800
- # 2. Instalar dependencias (si las hubiera)
801
- npm install
222
+ Preset always wins - tech-stack specific has priority over user preferences.
802
223
 
803
- # 3. Enlazar para desarrollo local
804
- npm link
224
+ ### Config Format (v2.8.0)
805
225
 
806
- # 4. Probar en un repositorio de prueba
807
- cd /path/to/test-repo
808
- claude-hooks install
226
+ ```json
227
+ {
228
+ "version": "2.8.0",
229
+ "preset": "backend",
230
+ "overrides": {
231
+ "github": {
232
+ "pr": {
233
+ "defaultBase": "develop",
234
+ "reviewers": ["user"],
235
+ "autoPush": true, // Auto-push unpublished branches (v2.11.0)
236
+ "pushConfirm": true, // Prompt before push (v2.11.0)
237
+ "showCommits": true, // Show commit preview (v2.11.0)
238
+ "verifyRemote": true // Verify remote exists (v2.11.0)
239
+ }
240
+ },
241
+ "subagents": { "batchSize": 2 }
242
+ }
243
+ }
809
244
  ```
810
245
 
811
- ### Workflow de Desarrollo
246
+ ### Key Patterns
812
247
 
813
- #### 1. Modificar Hooks
248
+ - **Factory**: `preset-loader.js` - dynamic config per tech-stack
249
+ - **Template Method**: `prompt-builder.js` - prompts from .md templates
250
+ - **Strategy**: `claude-client.js` - sequential vs parallel analysis
251
+ - **Adapter**: `git-operations.js` - git commands to JS functions
252
+ - **Command**: `lib/commands/*.js` - one module per CLI command
814
253
 
815
- **v2.0.0+**: La lógica de los hooks está en `lib/hooks/`:
254
+ ### Modification Guide
816
255
 
817
- - `lib/hooks/pre-commit.js` - Lógica de análisis de código (Node.js ES6)
818
- - `lib/hooks/prepare-commit-msg.js` - Lógica de generación de mensajes (Node.js ES6)
819
- - `templates/pre-commit` - Bash wrapper que llama al script Node.js
820
- - `templates/prepare-commit-msg` - Bash wrapper que llama al script Node.js
256
+ | To change... | Edit... |
257
+ |--------------|---------|
258
+ | CLI argument parsing | `bin/claude-hooks` |
259
+ | Install workflow | `lib/commands/install.js` |
260
+ | PR creation flow | `lib/commands/create-pr.js` |
261
+ | Analysis logic | `lib/hooks/pre-commit.js` |
262
+ | Message generation | `lib/hooks/prepare-commit-msg.js` |
263
+ | Prompt templates | `templates/*.md` or `.claude/prompts/*.md` |
264
+ | Preset definitions | `templates/presets/{name}/` |
265
+ | Config defaults | `lib/config.js` |
266
+ | GitHub integration | `lib/utils/github-api.js` |
267
+ | Claude CLI calls | `lib/utils/claude-client.js` |
821
268
 
822
- #### 2. Probar Localmente
269
+ ### File Structure
823
270
 
824
- ```bash
825
- # Después de modificar archivos, repo de claude-hooks
826
- npm link
827
-
828
- # En un repo de prueba
829
- claude-hooks install --force # Fuerza reinstalación, luego probar lo que se desee
271
+ ```
272
+ claude-git-hooks/
273
+ ├── bin/claude-hooks # Thin CLI router - dispatch to commands
274
+ ├── lib/
275
+ │ ├── config.js # Config system - load and merge
276
+ │ ├── commands/ # Command modules - one per CLI command
277
+ │ │ ├── helpers.js # Shared utilities - colors, output
278
+ │ │ ├── install.js # Install command - hooks, templates
279
+ │ │ ├── hooks.js # Hook management - enable/disable
280
+ │ │ ├── analyze-diff.js # Diff analysis - PR metadata
281
+ │ │ ├── create-pr.js # PR creation - Octokit workflow
282
+ │ │ ├── setup-github.js # Token setup - interactive config
283
+ │ │ ├── presets.js # Preset commands - list/set
284
+ │ │ ├── update.js # Self-update - npm latest
285
+ │ │ ├── migrate-config.js # Migration - legacy to v2.8.0
286
+ │ │ ├── debug.js # Debug mode - toggle verbose
287
+ │ │ ├── telemetry-cmd.js # Telemetry - show/clear stats
288
+ │ │ └── help.js # Help display - usage info
289
+ │ ├── hooks/ # Git hooks - Node.js logic
290
+ │ │ ├── pre-commit.js # Pre-commit analysis
291
+ │ │ └── prepare-commit-msg.js # Message generation
292
+ │ └── utils/ # Reusable modules - shared logic
293
+ ├── templates/
294
+ │ ├── pre-commit # Bash wrapper - invokes Node.js
295
+ │ ├── prepare-commit-msg # Bash wrapper - invokes Node.js
296
+ │ ├── *.md # Prompt templates
297
+ │ └── presets/ # Preset configurations
298
+ └── test/unit/ # Jest tests
830
299
  ```
831
300
 
832
- #### 3. Actualizar Documentación
301
+ ### Parallel Analysis (3+ files)
833
302
 
834
- - `README.md` - Documentación principal
835
- - `CHANGELOG.md` - Documentación principal
836
- - `README-NPM.md` - Para usuarios de NPM
303
+ Files split into batches, each batch runs in separate Claude CLI process:
304
+ - `batchSize: 1` Maximum parallelism (1 file per process)
305
+ - `batchSize: 2` Balanced (2 files per process)
306
+ - Results consolidated automatically
837
307
 
838
- #### 4. Versioning y Publicación
308
+ ### Hardcoded Defaults (v2.8.0)
839
309
 
840
- ```bash
841
- # Actualizar versión
842
- npm version patch # 1.0.0 -> 1.0.1
843
- npm version minor # 1.0.0 -> 1.1.0
844
- npm version major # 1.0.0 -> 2.0.0
310
+ - Max file size: 1MB
311
+ - Max files per commit: 20
312
+ - Parallel analysis: enabled
313
+ - Parallel model: haiku
314
+ - Parallel batch size: 3
845
315
 
846
- # Publicar nueva versión
847
- npm publish
848
- ```
316
+ ---
317
+
318
+ More information: https://github.com/mscope-S-L/git-hooks