claude-git-hooks 2.6.3 → 2.8.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/CHANGELOG.md +173 -0
- package/README.md +77 -58
- package/bin/claude-hooks +322 -27
- package/lib/config.js +176 -83
- package/lib/hooks/pre-commit.js +11 -14
- package/lib/hooks/prepare-commit-msg.js +2 -3
- package/lib/utils/claude-client.js +199 -34
- package/lib/utils/claude-diagnostics.js +102 -11
- package/lib/utils/prompt-builder.js +2 -2
- package/package.json +1 -1
- package/templates/{CLAUDE_ANALYSIS_PROMPT_SONAR.md → CLAUDE_ANALYSIS_PROMPT.md} +2 -1
- package/templates/{CLAUDE_PRE_COMMIT_SONAR.md → CLAUDE_PRE_COMMIT.md} +10 -1
- package/templates/CUSTOMIZATION_GUIDE.md +3 -3
- package/templates/config.advanced.example.json +113 -0
- package/templates/config.example.json +53 -36
- package/templates/presets/ai/ANALYSIS_PROMPT.md +1 -1
- package/templates/presets/ai/config.json +5 -12
- package/templates/presets/backend/ANALYSIS_PROMPT.md +1 -1
- package/templates/presets/backend/config.json +5 -12
- package/templates/presets/database/ANALYSIS_PROMPT.md +1 -1
- package/templates/presets/database/config.json +5 -12
- package/templates/presets/default/config.json +5 -12
- package/templates/presets/frontend/ANALYSIS_PROMPT.md +1 -1
- package/templates/presets/frontend/config.json +5 -12
- package/templates/presets/fullstack/ANALYSIS_PROMPT.md +1 -1
- package/templates/presets/fullstack/config.json +5 -12
- package/templates/shared/ANALYSIS_PROMPT.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,179 @@ Todos los cambios notables en este proyecto se documentarán en este archivo.
|
|
|
5
5
|
El formato está basado en [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.8.0] - 2025-12-24
|
|
9
|
+
|
|
10
|
+
### 🎨 Changed
|
|
11
|
+
|
|
12
|
+
- **Simplified configuration format** - New v2.8.0 config structure reduces redundancy and improves maintainability
|
|
13
|
+
- **What changed**: Config now uses `version` field and `overrides` structure, 21 parameters moved to hardcoded defaults
|
|
14
|
+
- **New format**: `{ "version": "2.8.0", "preset": "backend", "overrides": {...} }`
|
|
15
|
+
- **Old format**: `{ "preset": "backend", "analysis": {...}, "subagents": {...}, ... }` (20+ top-level keys)
|
|
16
|
+
- **User-configurable** (5 params): `preset`, `github.pr.*`, `subagents.batchSize`
|
|
17
|
+
- **Hardcoded** (21 params): `analysis.*` (maxFileSize, maxFiles, timeout), `commitMessage.*`, `templates.*`, etc.
|
|
18
|
+
- **Advanced** (3 params): `analysis.ignoreExtensions`, `commitMessage.taskIdPattern`, `subagents.model`
|
|
19
|
+
- **Files changed**:
|
|
20
|
+
- `lib/config.js:1-280` - Split into HARDCODED and defaults, added legacy format detection
|
|
21
|
+
- `templates/config.example.json` - New simplified format with examples
|
|
22
|
+
- `templates/config.advanced.example.json` - Advanced parameters with documentation
|
|
23
|
+
- `bin/claude-hooks:483-570` - Auto-migration during install
|
|
24
|
+
- **Impact**: Cleaner config files, sensible defaults work for 99% of users
|
|
25
|
+
|
|
26
|
+
- **Automatic config migration** - Legacy configs auto-migrate during installation with backup
|
|
27
|
+
- **What changed**: `claude-hooks install` detects legacy format and migrates automatically
|
|
28
|
+
- **Migration process**: Backup to `.claude/config_old/`, extract allowed params, create v2.8.0 config
|
|
29
|
+
- **Preserved settings**: `github.pr.*`, `subagents.batchSize`, and advanced params (with warnings)
|
|
30
|
+
- **Files changed**:
|
|
31
|
+
- `bin/claude-hooks:510-530,1942-2115` - Auto-migration in install, new `migrate-config` command
|
|
32
|
+
- **Impact**: Seamless upgrade path, settings preserved, zero manual work
|
|
33
|
+
|
|
34
|
+
- **Organized prompt templates** - All .md files moved to `.claude/prompts/` subdirectory
|
|
35
|
+
- **What changed**: Installation creates `.claude/prompts/` and places markdown templates there
|
|
36
|
+
- **Old location**: `.claude/CLAUDE_ANALYSIS_PROMPT.md`, `.claude/CLAUDE_PRE_COMMIT.md`, etc.
|
|
37
|
+
- **New location**: `.claude/prompts/CLAUDE_ANALYSIS_PROMPT.md`, `.claude/prompts/CLAUDE_PRE_COMMIT.md`, etc.
|
|
38
|
+
- **Auto-cleanup**: Old .md files in `.claude/` root are automatically removed during installation
|
|
39
|
+
- **Files changed**:
|
|
40
|
+
- `bin/claude-hooks:401-457` - Creates prompts directory, moves .md files, cleans up old files
|
|
41
|
+
- `lib/config.js:57` - Updated `templates.baseDir` to `.claude/prompts`
|
|
42
|
+
- **Impact**: Cleaner `.claude/` directory structure, prompts separated from config files
|
|
43
|
+
|
|
44
|
+
- **Parallel analysis enabled by default** - Subagents now hardcoded to enabled (was opt-in)
|
|
45
|
+
- **What changed**: `subagents.enabled` moved from user config to hardcoded `true`
|
|
46
|
+
- **Why**: Faster analysis is universally beneficial, no reason to disable
|
|
47
|
+
- **Files changed**: `lib/config.js:52-54` - Hardcoded `enabled: true`, `model: 'haiku'`, `batchSize: 3`
|
|
48
|
+
- **Impact**: All users get faster analysis out-of-box (4x speedup on 3+ files)
|
|
49
|
+
|
|
50
|
+
### ✨ Added
|
|
51
|
+
|
|
52
|
+
- **Config example files** - Split documentation into simple and advanced examples
|
|
53
|
+
- `templates/config.example.json` - Minimal config (99% of users) with inline examples
|
|
54
|
+
- `templates/config.advanced.example.json` - Advanced parameters with full documentation
|
|
55
|
+
- Installation copies both to `.claude/config_example/` for reference
|
|
56
|
+
- **Impact**: Clear guidance for common use cases, power users can tinker safely
|
|
57
|
+
|
|
58
|
+
- **Manual config migration command** - New `claude-hooks migrate-config` for manual upgrades
|
|
59
|
+
- Checks config version, creates backup in `.claude/config_old/`
|
|
60
|
+
- Extracts allowed parameters, warns about advanced params
|
|
61
|
+
- Shows diff preview before writing
|
|
62
|
+
- **Impact**: Users can migrate at their pace, review changes before applying
|
|
63
|
+
|
|
64
|
+
### 🔧 Fixed
|
|
65
|
+
|
|
66
|
+
- **Preset name now correctly displayed in hooks** - Fixed config loader not including preset name in final config
|
|
67
|
+
- **What was broken**: Hooks always showed "Default (General-purpose)" preset regardless of actual preset configured
|
|
68
|
+
- **Root cause**: Config loader extracted `presetName` but never added it to the final merged config object
|
|
69
|
+
- **Fix**: Add `preset` field to final config object after merge operations
|
|
70
|
+
- **Files changed**: `lib/config.js:181-184`
|
|
71
|
+
- **Impact**: Hooks now correctly display configured preset (e.g., "AI", "Backend", "Frontend")
|
|
72
|
+
|
|
73
|
+
- **Example configs no longer clutter .claude/** - Example files only exist in `.claude/config_example/`
|
|
74
|
+
- **What was broken**: Installation copied `*example.json` to both `.claude/` and `.claude/config_example/`
|
|
75
|
+
- **Fix**: Filter `*example.json` during template copy, only place in `config_example/`
|
|
76
|
+
- **Files changed**: `bin/claude-hooks:410-415,498-507`
|
|
77
|
+
- **Impact**: Cleaner `.claude/` directory without redundant example files
|
|
78
|
+
|
|
79
|
+
### ⚠️ Breaking Changes
|
|
80
|
+
|
|
81
|
+
- **Config format change** - Legacy config format (pre-v2.8.0) requires migration
|
|
82
|
+
- **Migration**: Automatic during `install`, or manual via `claude-hooks migrate-config`
|
|
83
|
+
- **Compatibility**: Legacy format still works with deprecation warning until v3.0.0
|
|
84
|
+
- **Action required**: None (auto-migrates), but consider running `migrate-config` to see diff
|
|
85
|
+
|
|
86
|
+
- **Template location change** - .md files moved from `.claude/` to `.claude/prompts/`
|
|
87
|
+
- **Migration**: Automatic during `install --force`
|
|
88
|
+
- **Custom templates**: If you customized templates, move them to `.claude/prompts/` manually
|
|
89
|
+
- **Impact**: Low - most users don't customize, system checks both locations
|
|
90
|
+
|
|
91
|
+
- **Hardcoded parameters** - 21 parameters no longer user-configurable in .claude/config.json
|
|
92
|
+
- **Removed from user config**: `analysis.*` (except ignoreExtensions), `commitMessage.*` (except taskIdPattern), `templates.*`, `output.*`, `system.*`, `git.*`, `subagents.enabled`, `subagents.model` (except in advanced config)
|
|
93
|
+
- **Rationale**: Sensible defaults work for everyone, reduces configuration complexity
|
|
94
|
+
- **Override**: Advanced params available in `config.advanced.example.json` (use with caution)
|
|
95
|
+
|
|
96
|
+
## [2.7.2] - 2025-12-23
|
|
97
|
+
|
|
98
|
+
### ✨ Added
|
|
99
|
+
|
|
100
|
+
- **Retry logic for PR commands** - Added automatic retry for `create-pr` and `analyze-diff` commands (#49)
|
|
101
|
+
- **What changed**: Both commands now use `executeClaudeWithRetry()` with exponential backoff (2s, 4s, 8s delays)
|
|
102
|
+
- **Impact**: PR creation and diff analysis now automatically recover from transient Claude API errors
|
|
103
|
+
- **Files changed**:
|
|
104
|
+
- `lib/utils/claude-client.js:676-745,846` - Created reusable `withRetry()` wrapper and `executeClaudeWithRetry()` export
|
|
105
|
+
- `bin/claude-hooks:11,972,1234` - Updated create-pr and analyze-diff to use retry logic
|
|
106
|
+
|
|
107
|
+
### 🐛 Fixed
|
|
108
|
+
|
|
109
|
+
- **Windows WSL timeout** - Increased WSL availability check from 3s to 15s to handle system load (#49)
|
|
110
|
+
- `lib/config.js:78` - Made configurable via `config.system.wslCheckTimeout`
|
|
111
|
+
- `lib/utils/claude-client.js:107` - Uses config value for WSL check
|
|
112
|
+
- **Duplicate task ID logging** - Removed redundant log in prepare-commit-msg (#49)
|
|
113
|
+
- `lib/hooks/prepare-commit-msg.js:191-193` - Removed duplicate logger.info call
|
|
114
|
+
|
|
115
|
+
### 🎯 Improved
|
|
116
|
+
|
|
117
|
+
- **Error diagnostics** - Added timing information to all error contexts (#49)
|
|
118
|
+
- `lib/utils/claude-client.js:248-340` - Added `elapsedTime`, `timeoutValue`, `retryAttempt` to errors
|
|
119
|
+
- `lib/utils/claude-diagnostics.js:118-143,187-344` - Created `formatTimingInfo()` helper, updated all error formatters
|
|
120
|
+
|
|
121
|
+
## [2.7.1] - 2025-12-22
|
|
122
|
+
|
|
123
|
+
### 🐛 Fixed
|
|
124
|
+
|
|
125
|
+
- **Improved reliability with automatic retry logic** - Fixed intermittent "Execution error" failures from Claude API
|
|
126
|
+
- **What was broken**: Claude CLI occasionally returned "Execution error" (15 chars) with exit code 0, causing commits to fail ~50% of the time
|
|
127
|
+
- **Root cause**: Claude API rate limiting or temporary backend issues returned error text instead of valid JSON, but was treated as success due to exit code 0
|
|
128
|
+
- **Fix**: Added detection for "Execution error" responses and automatic retry logic with 2-second delay
|
|
129
|
+
- **Files changed**:
|
|
130
|
+
- `lib/utils/claude-diagnostics.js:22-29,47-57,122-170,307-310` - Added EXECUTION_ERROR type detection and formatting
|
|
131
|
+
- `lib/utils/claude-client.js:24,246-270,620-679` - Check for error even with exit code 0, added retry logic
|
|
132
|
+
- **Impact**: Significantly improved reliability - transient API errors now automatically retry once, reducing failure rate
|
|
133
|
+
- **User experience**: Clear error messages explain the issue, automatic retry happens transparently with "⏳ Retrying..." message
|
|
134
|
+
|
|
135
|
+
### 🎯 User Experience
|
|
136
|
+
|
|
137
|
+
- **Before**: Commits failed ~50% of the time with cryptic "No valid JSON found" error, requiring manual retries
|
|
138
|
+
- **After**: System automatically detects and retries recoverable errors, with helpful messages explaining what's happening
|
|
139
|
+
- **Error messages**: Now include specific guidance for "Execution error" (likely rate limiting, try haiku model, commit fewer files)
|
|
140
|
+
|
|
141
|
+
## [2.7.0] - 2025-12-19
|
|
142
|
+
|
|
143
|
+
### 🎨 Changed
|
|
144
|
+
|
|
145
|
+
- **Simplified code analysis output format** - Replaced fake SonarQube metrics with issue count summary (#47)
|
|
146
|
+
- **What changed**: Removed BLOCKER/CRITICAL/MAJOR/MINOR severity labels and A-E reliability/security/maintainability ratings
|
|
147
|
+
- **Why**: Metrics were Claude's opinion presented as facts, causing confusion and false sense of precision
|
|
148
|
+
- **New format**: Simple summary "X issue(s) found across Y file(s)" or "✅ No issues found!"
|
|
149
|
+
- **Files changed**:
|
|
150
|
+
- `lib/hooks/pre-commit.js:67-100` - Replaced metrics display with issue count summary
|
|
151
|
+
- `templates/CLAUDE_PRE_COMMIT_SONAR.md` → `templates/CLAUDE_PRE_COMMIT.md` (renamed)
|
|
152
|
+
- `templates/CLAUDE_ANALYSIS_PROMPT_SONAR.md` → `templates/CLAUDE_ANALYSIS_PROMPT.md` (renamed)
|
|
153
|
+
- `lib/config.js:58-59` - Updated template paths to remove SONAR suffix
|
|
154
|
+
- `bin/claude-hooks:387-407` - Installer now removes old SONAR template files
|
|
155
|
+
- **Impact**: Cleaner output focused on actual issues, not fake quality scores
|
|
156
|
+
|
|
157
|
+
- **Added false-positive prevention guidance** - Pre-commit hook now avoids reporting improvements as issues (#47)
|
|
158
|
+
- **What was broken**: Hook reported routine improvements (better formatting, added docs) as CODE_SMELL issues
|
|
159
|
+
- **Root cause**: Prompts lacked explicit guidance to distinguish problems from improvements
|
|
160
|
+
- **Fix**: Added clear instructions to only report actual bugs, security issues, or quality degradations
|
|
161
|
+
- **New guidance in templates**:
|
|
162
|
+
- "Only report actual problems, bugs, security issues, or code quality concerns"
|
|
163
|
+
- "Do NOT report improvements, positive changes, or routine maintenance as issues"
|
|
164
|
+
- "It is perfectly acceptable to find ZERO issues - this is a positive outcome"
|
|
165
|
+
- "When in doubt, err on the side of NOT reporting it"
|
|
166
|
+
- **Files changed**:
|
|
167
|
+
- `templates/CLAUDE_PRE_COMMIT.md` - Added false-positive prevention section at top
|
|
168
|
+
- `templates/CLAUDE_ANALYSIS_PROMPT.md` - Updated instructions before JSON schema
|
|
169
|
+
- **Compatibility**: Existing configurations continue to work, but users get fewer false positives
|
|
170
|
+
|
|
171
|
+
### 🔧 Fixed
|
|
172
|
+
|
|
173
|
+
- **Pre-commit hook no longer reports improvements as issues** - Documentation additions and formatting improvements now correctly pass analysis (#47)
|
|
174
|
+
|
|
175
|
+
### ⚠️ Breaking Changes (Minor)
|
|
176
|
+
|
|
177
|
+
- **Template file renames**: `CLAUDE_PRE_COMMIT_SONAR.md` → `CLAUDE_PRE_COMMIT.md`, `CLAUDE_ANALYSIS_PROMPT_SONAR.md` → `CLAUDE_ANALYSIS_PROMPT.md`
|
|
178
|
+
- **Migration**: Installer automatically removes old files and installs new ones on `claude-hooks install --force`
|
|
179
|
+
- **Impact**: Low - most users don't customize these files. Custom templates need manual rename.
|
|
180
|
+
|
|
8
181
|
## [2.6.3]
|
|
9
182
|
|
|
10
183
|
### 🐛 Fixed
|
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Pre-commit Hook con Claude CLI
|
|
2
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
|
|
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.
|
|
4
8
|
|
|
5
9
|
## ✨ Novedad v2.0.0 - Ahora Cross-Platform
|
|
6
10
|
|
|
@@ -22,6 +26,7 @@
|
|
|
22
26
|
- 🚀 **Parallel Analysis**: Multiple Claude CLI processes analyzing file batches simultaneously (v2.2.0+)
|
|
23
27
|
- 🔄 **Auto-actualización**: Se mantiene actualizado automáticamente
|
|
24
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+)
|
|
25
30
|
|
|
26
31
|
## 📋 CHEATSHEET
|
|
27
32
|
|
|
@@ -159,16 +164,20 @@ export GITHUB_PERSONAL_ACCESS_TOKEN="ghp_tu_token_aqui"
|
|
|
159
164
|
### 4. Configurar reviewers y labels (opcional)
|
|
160
165
|
|
|
161
166
|
```bash
|
|
162
|
-
# Ver
|
|
167
|
+
# Ver .claude/config_example/ para más ejemplos
|
|
163
168
|
cat > .claude/config.json << 'EOF'
|
|
164
169
|
{
|
|
165
|
-
"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
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
|
+
}
|
|
172
181
|
}
|
|
173
182
|
}
|
|
174
183
|
}
|
|
@@ -201,40 +210,41 @@ Ver `templates/config.github.example.json` para configuración avanzada (reviewe
|
|
|
201
210
|
|
|
202
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.
|
|
203
212
|
|
|
204
|
-
### 🔧 Configuración Avanzada (v2.
|
|
213
|
+
### 🔧 Configuración Avanzada (v2.8.0+)
|
|
205
214
|
|
|
206
215
|
```bash
|
|
207
|
-
# Configuración vía .claude/config.json
|
|
216
|
+
# Configuración vía .claude/config.json (v2.8.0+)
|
|
208
217
|
.claude/
|
|
209
|
-
├── config.json # Configuración principal (
|
|
210
|
-
├──
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
#
|
|
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)
|
|
214
227
|
cat > .claude/config.json << 'EOF'
|
|
215
228
|
{
|
|
229
|
+
"version": "2.8.0",
|
|
216
230
|
"preset": "backend",
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
"
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
"subagents": {
|
|
228
|
-
"enabled": true,
|
|
229
|
-
"model": "haiku",
|
|
230
|
-
"batchSize": 3
|
|
231
|
-
},
|
|
232
|
-
"system": {
|
|
233
|
-
"debug": true
|
|
231
|
+
"overrides": {
|
|
232
|
+
"github": {
|
|
233
|
+
"pr": {
|
|
234
|
+
"defaultBase": "main",
|
|
235
|
+
"reviewers": ["tech-lead"]
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"subagents": {
|
|
239
|
+
"batchSize": 2
|
|
240
|
+
}
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
243
|
EOF
|
|
237
244
|
|
|
245
|
+
# Para configuración avanzada, consultar:
|
|
246
|
+
# .claude/config_example/config.advanced.example.json
|
|
247
|
+
|
|
238
248
|
# Personalizar patrón de task-id
|
|
239
249
|
# Default: 1-3 letras + separador + 3-5 dígitos
|
|
240
250
|
# Ejemplos válidos: ABC-12345, IX-123, DE 4567
|
|
@@ -352,31 +362,40 @@ git commit -m "fix: resolver issues"
|
|
|
352
362
|
### ⚡ Tips y Trucos
|
|
353
363
|
|
|
354
364
|
1. **Mensaje automático**: Usa `"auto"` como mensaje para que Claude lo genere con task-id automático
|
|
355
|
-
2. **Task-ID pattern**: Default 1-3 letras + separador + 3-5 dígitos (ABC-12345, IX-123). Configurable en `.claude/config.json`
|
|
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`
|
|
356
366
|
3. **Skip auth**: Usa `--skip-auth` en CI/CD o desarrollo local
|
|
357
367
|
4. **Force install**: Usa `--force` para reinstalar sin confirmación
|
|
358
|
-
5. **Debug**: Activa con `claude-hooks --debug true`
|
|
359
|
-
6. **Archivos grandes**: Se omiten automáticamente archivos > 1MB
|
|
360
|
-
7. **Límite de archivos**: Máximo
|
|
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.
|
|
361
375
|
|
|
362
|
-
|
|
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)
|
|
363
380
|
|
|
364
|
-
**
|
|
381
|
+
**Customizar batch size (opcional):**
|
|
365
382
|
|
|
366
383
|
```bash
|
|
367
|
-
#
|
|
384
|
+
# En .claude/config.json v2.8.0
|
|
368
385
|
{
|
|
369
|
-
"
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
"
|
|
386
|
+
"version": "2.8.0",
|
|
387
|
+
"preset": "backend",
|
|
388
|
+
"overrides": {
|
|
389
|
+
"subagents": {
|
|
390
|
+
"batchSize": 2
|
|
391
|
+
}
|
|
373
392
|
}
|
|
374
393
|
}
|
|
375
394
|
```
|
|
376
395
|
|
|
377
|
-
**Model options:**
|
|
396
|
+
**Model options (solo en config avanzado):**
|
|
378
397
|
|
|
379
|
-
- `haiku` - Fast & cheap (default
|
|
398
|
+
- `haiku` - Fast & cheap (default)
|
|
380
399
|
- `sonnet` - Balanced quality/speed
|
|
381
400
|
- `opus` - Maximum quality (slower)
|
|
382
401
|
|
|
@@ -417,9 +436,9 @@ git commit -m "fix: resolver issues"
|
|
|
417
436
|
|
|
418
437
|
**Archivos clave para modificar:**
|
|
419
438
|
|
|
420
|
-
- `.claude/config.json` - Configuración principal (v2.
|
|
421
|
-
- `.claude/
|
|
422
|
-
- `.claude/
|
|
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
|
|
423
442
|
|
|
424
443
|
**Crear o modificar presets personalizados:**
|
|
425
444
|
|
|
@@ -434,7 +453,7 @@ cat templates/CUSTOMIZATION_GUIDE.md
|
|
|
434
453
|
**Ejemplo:**
|
|
435
454
|
|
|
436
455
|
```bash
|
|
437
|
-
vim .claude/
|
|
456
|
+
vim .claude/prompts/CLAUDE_PRE_COMMIT.md # Agregar reglas API REST/Spring Boot
|
|
438
457
|
```
|
|
439
458
|
|
|
440
459
|
## 🔧 Configuración Previa Importante
|
|
@@ -501,8 +520,8 @@ El comando `claude-hooks install` crea los siguientes archivos y directorios:
|
|
|
501
520
|
2. **`.git/hooks/prepare-commit-msg`** - Hook de generación de mensajes
|
|
502
521
|
3. **`.git/hooks/check-version.sh`** - Script de verificación de versión
|
|
503
522
|
4. **`.claude/`** - Directorio para archivos de configuración
|
|
504
|
-
- `
|
|
505
|
-
- `
|
|
523
|
+
- `CLAUDE_PRE_COMMIT.md` - Criterios de evaluación de calidad
|
|
524
|
+
- `CLAUDE_ANALYSIS_PROMPT.md` - Template de prompt para análisis
|
|
506
525
|
- `CLAUDE_RESOLUTION_PROMPT.md` - Template para prompt de resolución AI
|
|
507
526
|
|
|
508
527
|
### Actualización automática de .gitignore
|
|
@@ -532,8 +551,8 @@ Si no existe un `.gitignore`, se creará uno nuevo. Si ya existe, las entradas s
|
|
|
532
551
|
- Omite archivos mayores a 1MB
|
|
533
552
|
- Límite de 30 archivos por commit
|
|
534
553
|
3. **Construye prompt inteligente**:
|
|
535
|
-
- Usa template de prompt desde `.claude/CLAUDE_ANALYSIS_PROMPT*.md`
|
|
536
|
-
- Lee las pautas desde `.claude/CLAUDE_PRE_COMMIT*.md`
|
|
554
|
+
- Usa template de prompt desde `.claude/prompts/CLAUDE_ANALYSIS_PROMPT*.md`
|
|
555
|
+
- Lee las pautas desde `.claude/prompts/CLAUDE_PRE_COMMIT*.md`
|
|
537
556
|
- Incluye el diff completo para archivos nuevos
|
|
538
557
|
- Muestra solo cambios para archivos existentes
|
|
539
558
|
4. **Envía a Claude CLI para revisión**
|
|
@@ -621,11 +640,11 @@ En `lib/hooks/prepare-commit-msg.js`:
|
|
|
621
640
|
|
|
622
641
|
### Pautas de Evaluación
|
|
623
642
|
|
|
624
|
-
- **`
|
|
643
|
+
- **`CLAUDE_PRE_COMMIT.md`** - Criterios de evaluación de calidad
|
|
625
644
|
|
|
626
645
|
### Templates de Prompts
|
|
627
646
|
|
|
628
|
-
- **`
|
|
647
|
+
- **`CLAUDE_ANALYSIS_PROMPT.md`** - Estructura del prompt de análisis
|
|
629
648
|
- **`CLAUDE_RESOLUTION_PROMPT.md`** - Template para generar prompts de resolución
|
|
630
649
|
|
|
631
650
|
Todos estos archivos son personalizables y específicos de tu proyecto. Puedes:
|
|
@@ -672,8 +691,8 @@ claude-git-hooks/
|
|
|
672
691
|
│ ├── pre-commit # Bash wrapper (llama a lib/hooks/pre-commit.js)
|
|
673
692
|
│ ├── prepare-commit-msg # Bash wrapper (llama a lib/hooks/prepare-commit-msg.js)
|
|
674
693
|
│ ├── check-version.sh # Script de verificación de versión
|
|
675
|
-
│ ├──
|
|
676
|
-
│ ├──
|
|
694
|
+
│ ├── CLAUDE_PRE_COMMIT.md # Criterios de evaluación
|
|
695
|
+
│ ├── CLAUDE_ANALYSIS_PROMPT.md # Template de prompt para análisis
|
|
677
696
|
│ ├── CLAUDE_RESOLUTION_PROMPT.md # Template para resolución de issues
|
|
678
697
|
│ ├── ANALYZE_DIFF.md # Template para análisis de diff (PR metadata)
|
|
679
698
|
│ ├── CREATE_GITHUB_PR.md # Template para creación de PR
|