claude-git-hooks 2.4.1 → 2.5.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 +250 -150
- package/README.md +126 -40
- package/bin/claude-hooks +436 -2
- package/lib/config.js +29 -0
- package/lib/hooks/pre-commit.js +2 -6
- package/lib/hooks/prepare-commit-msg.js +27 -4
- package/lib/utils/claude-client.js +108 -5
- package/lib/utils/file-operations.js +0 -102
- package/lib/utils/github-api.js +641 -0
- package/lib/utils/github-client.js +770 -0
- package/lib/utils/interactive-ui.js +314 -0
- package/lib/utils/mcp-setup.js +342 -0
- package/lib/utils/sanitize.js +180 -0
- package/lib/utils/task-id.js +425 -0
- package/package.json +4 -1
- package/templates/CREATE_GITHUB_PR.md +32 -0
- package/templates/config.github.example.json +51 -0
- package/templates/presets/ai/PRE_COMMIT_GUIDELINES.md +18 -1
- package/templates/presets/ai/preset.json +37 -37
- package/templates/settings.local.example.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,26 +5,118 @@ 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.5.0] - 2025-11-26
|
|
9
|
+
|
|
10
|
+
### ✨ Added
|
|
11
|
+
|
|
12
|
+
- **GitHub Integration - One-Command PR Creation** - Create pull requests with auto-generated metadata
|
|
13
|
+
- **What's new**: `claude-hooks create-pr [base]` command that creates PRs on GitHub via Octokit (deterministic)
|
|
14
|
+
- **Architecture**: Claude analyzes diff and generates metadata (brain) → Octokit creates PR (deterministic actions)
|
|
15
|
+
- **Key features**:
|
|
16
|
+
- **Task-ID Extraction**: Automatically extracts task identifiers from branch names (Jira: IX-123, GitHub: #456, Linear: LIN-123)
|
|
17
|
+
- **Smart PR Generation**: Claude analyzes git diff and generates PR title, description, reviewers, and labels
|
|
18
|
+
- **Deterministic Creation**: Octokit directly creates PR via GitHub REST API (no MCP dependencies)
|
|
19
|
+
- **Token Management**: 4-level priority (GITHUB_TOKEN env → GITHUB_PERSONAL_ACCESS_TOKEN env → .claude/settings.local.json → Claude Desktop config)
|
|
20
|
+
- **Auto-Reviewer Detection**: Detects reviewers from CODEOWNERS file, config patterns, or preset-based rules
|
|
21
|
+
- **Preset-Based Labels**: Automatically adds labels based on tech stack (backend → java/spring-boot, frontend → react/typescript)
|
|
22
|
+
- **Interactive Preview**: Shows formatted PR preview with confirmation before creating
|
|
23
|
+
- **Configurable Defaults**: Set default base branch, reviewers, labels, and rules in `.claude/config.json`
|
|
24
|
+
- **Error Recovery**: Saves PR metadata to .claude/out/pr-metadata.json on failure for manual retry
|
|
25
|
+
- **Task-ID in Commits**: Auto-detect task-id from branch when using `git commit -m "auto"` with configurable regex pattern
|
|
26
|
+
- **Task-ID Pattern (Configurable)**:
|
|
27
|
+
- **Default**: 1-3 uppercase letters + separator + 3-5 digits (e.g., ABC-12345, IX-123, DE 4567)
|
|
28
|
+
- **Config**: Set custom regex in `.claude/config.json` → `commitMessage.taskIdPattern`
|
|
29
|
+
- **Avoids false positives**: Won't match hashes (471459f), invalid formats (ABCD-123, IX-12)
|
|
30
|
+
- **Examples**: `([A-Z]{1,3}[-\\s]\\d{3,5})` (default), `([A-Z]{2,10}-\\d+)` (Jira-style)
|
|
31
|
+
- **New modules**:
|
|
32
|
+
- `lib/utils/task-id.js` - Reusable task-id extraction and formatting (29 tests)
|
|
33
|
+
- `lib/utils/github-api.js` - Direct Octokit integration (token resolution, PR creation, validation)
|
|
34
|
+
- `lib/utils/github-client.js` - GitHub MCP wrapper (deprecated, kept for compatibility)
|
|
35
|
+
- `lib/utils/interactive-ui.js` - Terminal UI helpers (preview, prompts, menus, spinners)
|
|
36
|
+
- **Configuration**: New `github.pr` section in config with reviewers, labels, and pattern rules
|
|
37
|
+
- **Files created**:
|
|
38
|
+
- `lib/utils/task-id.js` - Task ID extraction/formatting
|
|
39
|
+
- `lib/utils/github-api.js` - Octokit integration with token resolution
|
|
40
|
+
- `lib/utils/github-client.js` - GitHub MCP client wrapper (deprecated)
|
|
41
|
+
- `lib/utils/interactive-ui.js` - Interactive CLI components
|
|
42
|
+
- `templates/config.github.example.json` - Example GitHub configuration
|
|
43
|
+
- `templates/settings.local.example.json` - Local token storage template
|
|
44
|
+
- **Files updated**:
|
|
45
|
+
- `bin/claude-hooks:1044-1377` - Rewritten createPr() function with 13-step Octokit workflow
|
|
46
|
+
- `bin/claude-hooks:1299-1344` - New setupGitHub() function
|
|
47
|
+
- `bin/claude-hooks:1772-1774` - Added setup-github case statement
|
|
48
|
+
- `bin/claude-hooks:1515,1537-1548` - Updated help with token configuration
|
|
49
|
+
- `bin/claude-hooks:488-490` - Added GitHub PR creation to post-install message
|
|
50
|
+
- `lib/config.js:37-46` - Added commitMessage.taskIdPattern configuration
|
|
51
|
+
- `lib/config.js:81-102` - Simplified GitHub config, enabled by default
|
|
52
|
+
- `lib/utils/github-client.js:792-794` - Deprecation notice for MCP-based createPullRequest
|
|
53
|
+
- `lib/utils/task-id.js:21-55,71-98,107-144` - Made pattern configurable, reads from config
|
|
54
|
+
- `lib/hooks/prepare-commit-msg.js:27,182-193,280-290` - Added task-id detection with config support
|
|
55
|
+
- `package.json` - Added @octokit/rest ^21.0.0 dependency
|
|
56
|
+
- **Requirements**:
|
|
57
|
+
- GitHub token with repo and read:org scopes
|
|
58
|
+
- Repository must have GitHub remote origin
|
|
59
|
+
- **Token configuration**: `claude-hooks setup-github` guides through token setup
|
|
60
|
+
- **Comprehensive logging**: Debug logs throughout github-api.js and createPr() for troubleshooting
|
|
61
|
+
- **Dynamic user agent**: Version read from package.json to prevent staleness
|
|
62
|
+
- **Task-ID Detection**: Auto-extract or prompt for task-id in commit messages (Jira, GitHub, Linear)
|
|
63
|
+
- **Impact**: Developers can create well-formatted PRs with proper metadata in one command, reducing PR creation friction
|
|
64
|
+
|
|
65
|
+
### 🎯 User Experience
|
|
66
|
+
|
|
67
|
+
- **One-Command Workflow**: `claude-hooks create-pr develop` replaces manual PR creation steps
|
|
68
|
+
- **Deterministic & Reliable**: Octokit provides consistent PR creation (no MCP reliability issues)
|
|
69
|
+
- **Flexible Token Configuration**: Four methods to provide token - choose what works best for your setup
|
|
70
|
+
- **Clear Error Messages**: HTTP status codes (401, 403, 404, 422) with actionable suggestions
|
|
71
|
+
- **Setup Wizard**: `claude-hooks setup-github` validates token and guides configuration
|
|
72
|
+
- **Consistency**: All PRs follow same format with task-ids, descriptions, and appropriate reviewers
|
|
73
|
+
- **Interactive**: Preview and edit PR before creation, choose between Create/Edit/Cancel
|
|
74
|
+
- **Recovery Support**: Failed PRs save metadata to .claude/out/pr-metadata.json for manual retry
|
|
75
|
+
|
|
76
|
+
### 📚 Documentation
|
|
77
|
+
|
|
78
|
+
- **Help Text**: Added create-pr and setup-github commands to `claude-hooks help`
|
|
79
|
+
- **Token Configuration**: Clear explanation of 4-level token resolution priority
|
|
80
|
+
- **Use Cases**: Documented create-pr workflow with example output
|
|
81
|
+
- **Configuration Example**: Added `templates/config.github.example.json` with reviewer and label rules
|
|
82
|
+
- **Architecture Note**: Claude only for metadata generation (brain), Octokit for PR creation (deterministic actions)
|
|
83
|
+
- **Post-Install Message**: Added GitHub PR creation section with setup-github and create-pr examples
|
|
84
|
+
- **README Updates**:
|
|
85
|
+
- Quick Setup section for GitHub PR creation
|
|
86
|
+
- File structure updated with new GitHub modules
|
|
87
|
+
- Utility modules table includes github-api.js, task-id.js, interactive-ui.js
|
|
88
|
+
- Task-ID detection in commit messages documented
|
|
89
|
+
|
|
90
|
+
## [2.4.2] - 2025-11-24
|
|
91
|
+
|
|
92
|
+
### 🗑️ Removed
|
|
93
|
+
|
|
94
|
+
- **SKIP_ANALYSIS Feature** - Removed broken/experimental code exclusion feature
|
|
95
|
+
- **What was removed**: `// SKIP_ANALYSIS_LINE` and `// SKIP_ANALYSIS_BLOCK` comment markers
|
|
96
|
+
- **Why**: Feature never worked reliably - hooks analyze git diff instead of full files, so markers in previous commits weren't detected
|
|
97
|
+
- **Impact**: No user action needed - feature was marked EXPERIMENTAL/BROKEN and wasn't functional
|
|
98
|
+
- **Cleanup**: Removed all code, documentation, and references from README.md, CHANGELOG.md
|
|
99
|
+
|
|
8
100
|
## [2.4.1] - 2025-11-19
|
|
9
101
|
|
|
10
102
|
### 🐛 Fixed
|
|
11
103
|
|
|
12
104
|
- **Git Bash Windows Support** - Claude hooks now works correctly on Git Bash in Windows
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
105
|
+
- **What changed**:
|
|
106
|
+
- `--skip-auth` now skips both Claude CLI verification AND authentication (previously only auth)
|
|
107
|
+
- Windows detection now tries native Claude first, WSL as fallback
|
|
108
|
+
- `spawn()` now uses `shell: true` to resolve `.cmd`/`.bat` executables
|
|
109
|
+
- **Why**:
|
|
110
|
+
- Installation with `--skip-auth` was failing before copying `.md` files and presets
|
|
111
|
+
- Code assumed Claude must always run via WSL on Windows, ignoring native installations
|
|
112
|
+
- Git Bash runs Node.js natively on Windows, not in WSL
|
|
113
|
+
- `spawn()` without shell couldn't find Windows batch files
|
|
114
|
+
- **Files updated**:
|
|
115
|
+
- `bin/claude-hooks:512-518` - Skip auth now skips Claude CLI check
|
|
116
|
+
- `bin/claude-hooks:532-544` - Native Windows Claude detection
|
|
117
|
+
- `lib/utils/claude-client.js:75-115` - Smart platform detection with fallback
|
|
118
|
+
- `lib/utils/claude-client.js:145-148` - Added `shell: true` for Windows compatibility
|
|
119
|
+
- **Impact**: Git Bash users on Windows can now use native Claude (via npm/NVM) instead of requiring WSL
|
|
28
120
|
|
|
29
121
|
### 🎯 User Experience
|
|
30
122
|
|
|
@@ -37,111 +129,111 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
|
|
|
37
129
|
### ⚠️ BREAKING CHANGES
|
|
38
130
|
|
|
39
131
|
- **Debug Mode** - Environment variable `DEBUG` no longer supported
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
132
|
+
- **What changed**: Removed `DEBUG` environment variable support from `lib/utils/logger.js`
|
|
133
|
+
- **Why**: Aligns with project philosophy "no environment variables" and provides better user experience
|
|
134
|
+
- **Migration**: Use `claude-hooks --debug true` instead of `DEBUG=1 git commit`
|
|
135
|
+
- **Alternative**: Set `"system": { "debug": true }` in `.claude/config.json`
|
|
44
136
|
|
|
45
137
|
### 🔄 Changed
|
|
46
138
|
|
|
47
139
|
- **File Size Limit Increased** - Default `maxFileSize` increased from 100KB to 1MB
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
140
|
+
- **What changed**: `analysis.maxFileSize` now defaults to 1000000 (1MB) instead of 100000 (100KB)
|
|
141
|
+
- **Why**: Previous 100KB limit was too restrictive, rejected many legitimate source files
|
|
142
|
+
- **Files updated**:
|
|
143
|
+
- `lib/config.js:29` - Default configuration
|
|
144
|
+
- All preset configs in `templates/presets/*/config.json`
|
|
145
|
+
- `templates/config.example.json`
|
|
146
|
+
- **Impact**: More files will be analyzed without manual config adjustment
|
|
147
|
+
- **User action**: If you want stricter limits, set `"maxFileSize": 100000` in `.claude/config.json`
|
|
56
148
|
|
|
57
149
|
### ✨ Added
|
|
58
150
|
|
|
59
151
|
- **Debug CLI Command** - New `--debug` flag for managing debug mode
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
152
|
+
- **Usage**: `claude-hooks --debug <true|false|status>`
|
|
153
|
+
- **Purpose**: Enables detailed logging for troubleshooting
|
|
154
|
+
- **Implementation**: Generic `updateConfig()` function in `bin/claude-hooks:1262`
|
|
155
|
+
- **Benefits**: Consistent with `--set-preset` pattern, no need to remember env var syntax
|
|
64
156
|
|
|
65
157
|
- **Generic Config Updater** - Reusable `updateConfig()` function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
158
|
+
- **Purpose**: Centralized config update logic for all CLI commands
|
|
159
|
+
- **Location**: `bin/claude-hooks:1262`
|
|
160
|
+
- **Features**: Dot notation path support, custom validators, custom success messages
|
|
161
|
+
- **Extensibility**: Easy to add new config commands (`--set-max-files`, `--set-timeout`, etc.)
|
|
70
162
|
|
|
71
163
|
### 🔄 Changed
|
|
72
164
|
|
|
73
165
|
- **setPreset() Refactored** - Now uses generic `updateConfig()` function
|
|
74
|
-
|
|
75
|
-
|
|
166
|
+
- **Effect**: Less code duplication, consistent error handling
|
|
167
|
+
- **Location**: `bin/claude-hooks:1349`
|
|
76
168
|
|
|
77
169
|
- **Debug Mode Activation** - Hooks now enable debug from config
|
|
78
|
-
|
|
79
|
-
|
|
170
|
+
- **Files**: `lib/hooks/pre-commit.js:185`, `lib/hooks/prepare-commit-msg.js:124`
|
|
171
|
+
- **Effect**: Debug logs appear when `config.system.debug` is true
|
|
80
172
|
|
|
81
173
|
### 📚 Documentation
|
|
82
174
|
|
|
83
175
|
- **Help Text Updated** - Added `--debug` command documentation
|
|
84
|
-
|
|
85
|
-
|
|
176
|
+
- **Location**: `bin/claude-hooks:1170`
|
|
177
|
+
- **Includes**: Command description, examples, debug mode section
|
|
86
178
|
|
|
87
179
|
- **README.md Updated** - Debug command documented in multiple sections
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
180
|
+
- **Cheatsheet**: Added debug commands to "Comandos Frecuentes" (line 52-56)
|
|
181
|
+
- **Tips**: Updated tip #4 with CLI command (line 269)
|
|
182
|
+
- **Features**: Updated debug mode description (line 492)
|
|
91
183
|
|
|
92
184
|
## [2.3.1] - 2025-11-13
|
|
93
185
|
|
|
94
186
|
### 🔄 Changed
|
|
95
187
|
|
|
96
188
|
- **Configuration Priority** - Updated merge order: `defaults < user config < preset config`
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
189
|
+
- **Rationale**: User sets general preferences in `.claude/config.json`, preset provides tech-stack-specific overrides (highest priority)
|
|
190
|
+
- **Effect**: Presets now correctly override user settings (e.g., preset's `model: sonnet` wins over user's `model: haiku`)
|
|
191
|
+
- **Files updated**: `lib/config.js:116` (merge logic), README.md:222 (documentation)
|
|
100
192
|
|
|
101
193
|
### ✨ Added
|
|
102
194
|
|
|
103
195
|
- **Installation Diagnostics Utility** - New `lib/utils/installation-diagnostics.js`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
196
|
+
- **Purpose**: Reusable error diagnostics with actionable remediation steps
|
|
197
|
+
- **Exports**: `formatError()`, `getInstallationDiagnostics()`, `isInstallationHealthy()`
|
|
198
|
+
- **Use case**: Detects installation in wrong directory (common cause of "presets not found" errors)
|
|
199
|
+
- **Extensible**: Documented future enhancements (file permissions, Claude CLI check, etc.)
|
|
108
200
|
|
|
109
201
|
- **Enhanced Error Messages** - Better guidance when installation fails
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
202
|
+
- **Presets not found** (`lib/utils/preset-loader.js:194`): Shows current vs repo root directory
|
|
203
|
+
- **Hook scripts missing** (`templates/pre-commit:76`, `templates/prepare-commit-msg:76`): Early `.claude/` check with remediation steps
|
|
204
|
+
- **npm package issues**: Suggests verifying `npm list -g claude-git-hooks`
|
|
113
205
|
|
|
114
206
|
- **Bash Wrapper Early Validation** - Hooks now check `.claude/` exists before attempting execution
|
|
115
|
-
|
|
116
|
-
|
|
207
|
+
- **Why**: Fails fast with helpful message if installation incomplete or performed from wrong directory
|
|
208
|
+
- **Effect**: Users immediately know to `cd` to repo root and reinstall
|
|
117
209
|
|
|
118
210
|
- **Claude Error Diagnostics** - New `lib/utils/claude-diagnostics.js`
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
211
|
+
- **Purpose**: Detects and formats Claude CLI errors with actionable solutions
|
|
212
|
+
- **Error types**: Rate limit, authentication, network, invalid response, generic
|
|
213
|
+
- **Exports**: `detectClaudeError()`, `formatClaudeError()`, `ClaudeErrorType`, `isRecoverableError()`
|
|
214
|
+
- **Integration**: `lib/utils/claude-client.js:147` automatically detects and formats errors
|
|
215
|
+
- **Effect**: Users see clear guidance (e.g., "Rate limit resets in 2 hours, switch to haiku model")
|
|
124
216
|
|
|
125
217
|
### 📚 Documentation
|
|
126
218
|
|
|
127
219
|
- **CUSTOMIZATION_GUIDE.md** - Comprehensive preset creation guide in `/templates`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
220
|
+
- Visual flowchart showing prompt assembly (8-step diagram)
|
|
221
|
+
- Step-by-step preset creation tutorial
|
|
222
|
+
- Placeholder system reference with examples
|
|
223
|
+
- Preset kickstart prompt for Claude-assisted generation
|
|
224
|
+
- **Burst limit warning**: Explains why git hooks hit rate limits when manual CLI doesn't
|
|
225
|
+
- Referenced in README.md:333 for discoverability
|
|
134
226
|
|
|
135
227
|
- **Utility Modules Reference** - New section in README.md:596
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
228
|
+
- Table of all `lib/utils/` modules with purpose and key exports
|
|
229
|
+
- Usage examples for other Claude instances
|
|
230
|
+
- Promotes code reuse across projects
|
|
139
231
|
|
|
140
232
|
- **README-NPM.md** - Complete rewrite for npm package page
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
233
|
+
- **Length**: 266 lines (up from 145 lines, but more focused)
|
|
234
|
+
- **Updated**: v2.3.0 presets, v2.2.0 config centralization, v2.0.0 cross-platform
|
|
235
|
+
- **Added**: Configuration priority explanation, troubleshooting, "What's New" section
|
|
236
|
+
- **Removed**: Outdated v1.x references, environment variable examples
|
|
145
237
|
|
|
146
238
|
### 🎯 User Experience
|
|
147
239
|
|
|
@@ -156,27 +248,27 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
|
|
|
156
248
|
### ✨ Added
|
|
157
249
|
|
|
158
250
|
- **Preset System (Phase 3)**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
251
|
+
- 🎯 6 built-in presets: `backend`, `frontend`, `fullstack`, `database`, `ai`, `default`
|
|
252
|
+
- 📦 Self-contained preset packages with custom prompts and configurations
|
|
253
|
+
- 🔍 Smart file filtering per preset (`.java` for backend, `.tsx` for frontend, etc.)
|
|
254
|
+
- 🎨 Rich metadata: tech stack, focus areas, file extensions, display names
|
|
255
|
+
- 🔌 Template inheritance with placeholder replacement ({{TECH_STACK}}, {{FOCUS_AREAS}})
|
|
256
|
+
- 🛠️ Manual preset selection via CLI: `claude-hooks --set-preset <name>`
|
|
257
|
+
- 📋 Preset management commands: `presets`, `preset current`, `--set-preset`
|
|
258
|
+
- 📖 See `next-steps/V2.3.0_PHASE3_PRESETS_FINAL.md` for full specification
|
|
167
259
|
|
|
168
260
|
- **CLI Enhancements**
|
|
169
|
-
|
|
170
|
-
|
|
261
|
+
- 🏷️ Added `--version`, `-v`, and `version` commands to display current version
|
|
262
|
+
- 📊 Version check on install with interactive update prompt (skippable with `--skip-auth` or `--force`)
|
|
171
263
|
|
|
172
264
|
### 🐛 Fixed
|
|
173
265
|
|
|
174
266
|
- **Critical Bug**: `prepare-commit-msg` now properly loads merged config (preset + user overrides)
|
|
175
|
-
|
|
176
|
-
|
|
267
|
+
- Was using sync default import instead of async `getConfig()`
|
|
268
|
+
- Preset settings were being ignored in commit message generation
|
|
177
269
|
- **Template Name Mismatch**: Fixed config.js template paths
|
|
178
|
-
|
|
179
|
-
|
|
270
|
+
- `COMMIT_MESSAGE.md` (was `CLAUDE_COMMIT_MESSAGE.md`)
|
|
271
|
+
- `ANALYZE_DIFF.md` (was `CLAUDE_ANALYZE_DIFF.md`)
|
|
180
272
|
- **Missing Auto-Update**: `checkVersionAndPromptUpdate()` now called during install
|
|
181
273
|
|
|
182
274
|
### 🗑️ Removed
|
|
@@ -239,45 +331,45 @@ git commit -m "message" # Now filters to .java, .xml, .yml only
|
|
|
239
331
|
### ✨ Added
|
|
240
332
|
|
|
241
333
|
- **Configuration Centralization (Phase 1)**
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
334
|
+
- 📁 Created `lib/config.js` - single source of truth for all configurable values
|
|
335
|
+
- 🔧 User override support via `.claude/config.json` with deep merge
|
|
336
|
+
- 📊 Structured config: analysis, commitMessage, subagents, templates, output, system, git
|
|
337
|
+
- 🚫 Eliminated environment variables (except OS for platform detection)
|
|
338
|
+
- 📖 See `next-steps/V2.2.0_CONFIG_CENTRALIZATION.md` for details
|
|
247
339
|
|
|
248
340
|
- **Prompt Externalization (Phase 2)**
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
341
|
+
- 📝 Extracted ALL embedded prompts to external .md template files
|
|
342
|
+
- 🔌 Created `loadPrompt()` utility - combines load + variable replacement
|
|
343
|
+
- 📄 New templates: `COMMIT_MESSAGE.md`, `ANALYZE_DIFF.md`
|
|
344
|
+
- 🎯 JavaScript is now completely "prompt-agnostic"
|
|
345
|
+
- 📖 See `next-steps/V2.2.0_PHASE2_PROMPTS.md` for details
|
|
254
346
|
|
|
255
347
|
- **Parallel Analysis**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
348
|
+
- 🚀 True OS-level parallel execution using multiple Claude CLI processes simultaneously
|
|
349
|
+
- ⚡ `analyzeCodeParallel()` function runs batches via Node.js `Promise.all()`
|
|
350
|
+
- 📊 Configurable `batchSize` for optimal speed/cost balance (default: 2)
|
|
351
|
+
- 🔀 Automatic result consolidation with worst-case quality gate logic
|
|
352
|
+
- 📈 Real-time console output showing parallel batch launches and completion
|
|
353
|
+
- 🎯 Enabled by default for commits with 3+ files
|
|
354
|
+
- ⏱️ Speed improvement: up to 4x faster with `batchSize: 1`
|
|
263
355
|
|
|
264
356
|
### 🔄 Changed
|
|
265
357
|
|
|
266
358
|
- **Configuration Migration**
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
359
|
+
- ♻️ Migrated `lib/hooks/pre-commit.js` to use centralized config
|
|
360
|
+
- ♻️ Migrated `lib/hooks/prepare-commit-msg.js` to use centralized config
|
|
361
|
+
- ♻️ Migrated `lib/utils/claude-client.js` to use centralized config
|
|
362
|
+
- 🔧 `process.env.DEBUG` → `config.system.debug`
|
|
363
|
+
- 🔧 All hardcoded timeouts now configurable
|
|
272
364
|
|
|
273
365
|
- **Prompt Migration**
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
366
|
+
- ♻️ `prepare-commit-msg.js`: 40 lines → 15 lines (62% reduction)
|
|
367
|
+
- ♻️ `bin/claude-hooks`: 30 lines → 10 lines (67% reduction)
|
|
368
|
+
- 🎨 Prompts now editable without touching JavaScript code
|
|
277
369
|
|
|
278
370
|
- **Template Loading**
|
|
279
|
-
|
|
280
|
-
|
|
371
|
+
- 📂 Enhanced `loadTemplate()` with fallback: `.claude/` → `templates/`
|
|
372
|
+
- 🔀 Enables per-project customization of prompts
|
|
281
373
|
|
|
282
374
|
### 🗑️ Removed
|
|
283
375
|
|
|
@@ -302,6 +394,7 @@ git commit -m "message" # Now filters to .java, .xml, .yml only
|
|
|
302
394
|
No breaking changes. All defaults match previous behavior.
|
|
303
395
|
|
|
304
396
|
**Optional: Customize configuration**
|
|
397
|
+
|
|
305
398
|
```bash
|
|
306
399
|
# Create project config
|
|
307
400
|
mkdir -p .claude
|
|
@@ -323,6 +416,7 @@ EOF
|
|
|
323
416
|
```
|
|
324
417
|
|
|
325
418
|
**Optional: Customize prompts**
|
|
419
|
+
|
|
326
420
|
```bash
|
|
327
421
|
# Override commit message prompt
|
|
328
422
|
cp templates/COMMIT_MESSAGE.md .claude/
|
|
@@ -369,6 +463,7 @@ El marcador de bloque `// SKIP_ANALYSIS_BLOCK` permanece sin cambios.
|
|
|
369
463
|
|
|
370
464
|
**Why this change?**
|
|
371
465
|
The bash-based hooks created fundamental incompatibilities with Windows Git and IDE workflows (VSCode, IntelliJ), causing:
|
|
466
|
+
|
|
372
467
|
- Git worktree path conflicts (Windows paths incompatible with WSL)
|
|
373
468
|
- IDE commit failures when using Windows Git
|
|
374
469
|
- Developers forced to use WSL terminal exclusively, abandoning IDE Git features
|
|
@@ -376,16 +471,19 @@ The bash-based hooks created fundamental incompatibilities with Windows Git and
|
|
|
376
471
|
### ✅ Advantages
|
|
377
472
|
|
|
378
473
|
**Cross-Platform Native Support**
|
|
474
|
+
|
|
379
475
|
- ✅ Works with Windows Git, WSL, and Bash
|
|
380
476
|
- ✅ No more worktree path issues
|
|
381
477
|
- ✅ Single codebase for all platforms
|
|
382
478
|
|
|
383
479
|
**Dramatically Improved Maintainability**
|
|
480
|
+
|
|
384
481
|
- ✅ JavaScript/Node.js: ~60-70% of developers proficient vs ~1-2% with bash/jq/sed/awk
|
|
385
482
|
- ✅ Modern tooling: ESLint, Prettier, Jest testing framework
|
|
386
483
|
- ✅ VS Code debugging support vs echo statements
|
|
387
484
|
|
|
388
485
|
**Professional Development Practices**
|
|
486
|
+
|
|
389
487
|
- ✅ Unit and integration testing with Jest
|
|
390
488
|
- ✅ Type safety optional (TypeScript)
|
|
391
489
|
- ✅ Consistent error handling patterns
|
|
@@ -398,6 +496,7 @@ The bash-based hooks created fundamental incompatibilities with Windows Git and
|
|
|
398
496
|
### 🏆 Industry Success Cases
|
|
399
497
|
|
|
400
498
|
**Node.js Git Hooks - Proven Track Record:**
|
|
499
|
+
|
|
401
500
|
- **Husky**: 43k GitHub stars, 500+ contributors, 7M+ weekly npm downloads
|
|
402
501
|
- **lint-staged**: 12k stars, 200+ contributors
|
|
403
502
|
- **Commitizen**: 16k stars, industry standard
|
|
@@ -412,6 +511,7 @@ The bash-based hooks created fundamental incompatibilities with Windows Git and
|
|
|
412
511
|
### Migration Guide
|
|
413
512
|
|
|
414
513
|
Existing installations will continue working. To upgrade:
|
|
514
|
+
|
|
415
515
|
1. Run `claude-hooks update` to get v2.0.0
|
|
416
516
|
2. Run `claude-hooks install --force` to reinstall with Node.js hooks
|
|
417
517
|
3. No configuration changes needed - works transparently
|
|
@@ -421,27 +521,27 @@ Existing installations will continue working. To upgrade:
|
|
|
421
521
|
### Added
|
|
422
522
|
|
|
423
523
|
- 🚀 **Parallel Analysis with Subagents**
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
524
|
+
- New `CLAUDE_USE_SUBAGENTS` environment variable to enable parallel file analysis
|
|
525
|
+
- Each file analyzed by dedicated Claude subagent for faster processing
|
|
526
|
+
- Works across all analysis functions: pre-commit, message generation, and analyze-diff
|
|
527
|
+
- Significantly faster for commits with 3+ files
|
|
428
528
|
|
|
429
529
|
- ⚙️ **Subagent Configuration Options**
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
530
|
+
- `CLAUDE_SUBAGENT_MODEL` - Choose model: haiku (fast), sonnet (balanced), opus (thorough)
|
|
531
|
+
- `CLAUDE_SUBAGENT_BATCH_SIZE` - Control parallel processing (default: 3 files at once)
|
|
532
|
+
- Automatic result consolidation across all subagents
|
|
433
533
|
|
|
434
534
|
- ⏱️ **Execution Time Measurement**
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
535
|
+
- All operations now display execution time in seconds and milliseconds
|
|
536
|
+
- Pre-commit analysis: Shows time on success and failure
|
|
537
|
+
- Message generation: Shows generation time
|
|
538
|
+
- Analyze-diff: Shows analysis time
|
|
539
|
+
- Helps identify performance improvements and bottlenecks
|
|
440
540
|
|
|
441
541
|
- 🔧 **Git Worktree Support**
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
542
|
+
- `claude-hooks` now recognizes worktrees created in PowerShell from WSL
|
|
543
|
+
- Automatically converts Windows paths (C:\) to WSL paths (/mnt/c/)
|
|
544
|
+
- No more "not a git repository" errors when working in cross-platform worktrees
|
|
445
545
|
|
|
446
546
|
### Changed
|
|
447
547
|
|
|
@@ -456,14 +556,14 @@ Existing installations will continue working. To upgrade:
|
|
|
456
556
|
### Fixed
|
|
457
557
|
|
|
458
558
|
- 🔧 **Generación de prompt de resolución en modo SonarQube**
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
559
|
+
- Ahora se genera correctamente `claude_resolution_prompt.md` cuando el Quality Gate falla
|
|
560
|
+
- El archivo se genera cuando hay `blockingIssues`, independiente del tipo de fallo
|
|
561
|
+
- Corregido el flujo para que siempre muestre los issues críticos antes de generar el prompt
|
|
462
562
|
|
|
463
563
|
- 🎯 **Unificación de lógica de análisis**
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
564
|
+
- Eliminada lógica duplicada entre modo "clásico" y SonarQube
|
|
565
|
+
- Ahora siempre se usa modo SonarQube (como se especificó en v1.4.1)
|
|
566
|
+
- Simplificación del flujo de decisión en el pre-commit hook
|
|
467
567
|
|
|
468
568
|
### Changed
|
|
469
569
|
|
|
@@ -475,9 +575,9 @@ Existing installations will continue working. To upgrade:
|
|
|
475
575
|
### Fixed
|
|
476
576
|
|
|
477
577
|
- 🔧 Comando `analyze-diff` ahora siempre compara con ramas origin
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
578
|
+
- Si se especifica rama: compara con `origin/rama-especificada`
|
|
579
|
+
- Si no se especifica: compara con `origin/rama-actual`
|
|
580
|
+
- Fallback automático a `origin/develop` y luego `origin/main` si no existe la rama origin
|
|
481
581
|
|
|
482
582
|
### Changed
|
|
483
583
|
|
|
@@ -508,13 +608,13 @@ Existing installations will continue working. To upgrade:
|
|
|
508
608
|
### Added
|
|
509
609
|
|
|
510
610
|
- 🔍 Nuevo comando `claude-hooks analyze-diff [base]` para análisis de diferencias entre ramas
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
611
|
+
- Genera título de PR conciso (máx. 72 caracteres)
|
|
612
|
+
- Crea descripción detallada del PR con markdown
|
|
613
|
+
- Sugiere nombre de rama siguiendo formato tipo/descripcion
|
|
614
|
+
- Identifica tipo de cambio (feature/fix/refactor/docs/test/chore)
|
|
615
|
+
- Detecta breaking changes
|
|
616
|
+
- Proporciona notas de testing recomendado
|
|
617
|
+
- Guarda resultados en `.claude-pr-analysis.json`
|
|
518
618
|
|
|
519
619
|
### Changed
|
|
520
620
|
|
|
@@ -538,11 +638,11 @@ Existing installations will continue working. To upgrade:
|
|
|
538
638
|
### Added
|
|
539
639
|
|
|
540
640
|
- 🚫 Comentario `// SKIP-ANALYSIS` para excluir código del análisis
|
|
541
|
-
|
|
542
|
-
|
|
641
|
+
- Una línea: excluye la siguiente línea
|
|
642
|
+
- Bloque: código entre dos comentarios `// SKIP_ANALYSIS_BLOCK` es excluido
|
|
543
643
|
- 📝 Excepciones para Spring Framework en criterios de evaluación
|
|
544
|
-
|
|
545
|
-
|
|
644
|
+
- `@Autowired` no es considerado issue bloqueante (máximo severidad MAJOR)
|
|
645
|
+
- Inyección de dependencias con field injection es aceptable
|
|
546
646
|
|
|
547
647
|
### Changed
|
|
548
648
|
|