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