claude-git-hooks 2.4.0 → 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 +262 -135
- package/README.md +158 -67
- package/bin/claude-hooks +452 -10
- 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 +148 -16
- 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.example.json +41 -41
- package/templates/config.github.example.json +51 -0
- package/templates/presets/ai/PRE_COMMIT_GUIDELINES.md +18 -1
- package/templates/presets/ai/config.json +12 -12
- package/templates/presets/ai/preset.json +37 -42
- package/templates/presets/backend/ANALYSIS_PROMPT.md +23 -28
- package/templates/presets/backend/PRE_COMMIT_GUIDELINES.md +41 -3
- package/templates/presets/backend/config.json +12 -12
- package/templates/presets/database/config.json +12 -12
- package/templates/presets/default/config.json +12 -12
- package/templates/presets/frontend/config.json +12 -12
- package/templates/presets/fullstack/config.json +12 -12
- package/templates/settings.local.example.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,116 +5,235 @@ 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
|
+
|
|
100
|
+
## [2.4.1] - 2025-11-19
|
|
101
|
+
|
|
102
|
+
### 🐛 Fixed
|
|
103
|
+
|
|
104
|
+
- **Git Bash Windows Support** - Claude hooks now works correctly on Git Bash in Windows
|
|
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
|
|
120
|
+
|
|
121
|
+
### 🎯 User Experience
|
|
122
|
+
|
|
123
|
+
- **Installation**: `claude-hooks install --skip-auth` now completes successfully, installing all templates and presets
|
|
124
|
+
- **NVM Compatibility**: Works with Claude CLI installed via npm in current Node version (NVM managed)
|
|
125
|
+
- **Flexible Setup**: Automatically detects and uses best available Claude CLI method (native Windows or WSL)
|
|
126
|
+
|
|
8
127
|
## [2.4.0] - 2025-11-17
|
|
9
128
|
|
|
10
129
|
### ⚠️ BREAKING CHANGES
|
|
11
130
|
|
|
12
131
|
- **Debug Mode** - Environment variable `DEBUG` no longer supported
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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`
|
|
17
136
|
|
|
18
137
|
### 🔄 Changed
|
|
19
138
|
|
|
20
139
|
- **File Size Limit Increased** - Default `maxFileSize` increased from 100KB to 1MB
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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`
|
|
29
148
|
|
|
30
149
|
### ✨ Added
|
|
31
150
|
|
|
32
151
|
- **Debug CLI Command** - New `--debug` flag for managing debug mode
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
37
156
|
|
|
38
157
|
- **Generic Config Updater** - Reusable `updateConfig()` function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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.)
|
|
43
162
|
|
|
44
163
|
### 🔄 Changed
|
|
45
164
|
|
|
46
165
|
- **setPreset() Refactored** - Now uses generic `updateConfig()` function
|
|
47
|
-
|
|
48
|
-
|
|
166
|
+
- **Effect**: Less code duplication, consistent error handling
|
|
167
|
+
- **Location**: `bin/claude-hooks:1349`
|
|
49
168
|
|
|
50
169
|
- **Debug Mode Activation** - Hooks now enable debug from config
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
53
172
|
|
|
54
173
|
### 📚 Documentation
|
|
55
174
|
|
|
56
175
|
- **Help Text Updated** - Added `--debug` command documentation
|
|
57
|
-
|
|
58
|
-
|
|
176
|
+
- **Location**: `bin/claude-hooks:1170`
|
|
177
|
+
- **Includes**: Command description, examples, debug mode section
|
|
59
178
|
|
|
60
179
|
- **README.md Updated** - Debug command documented in multiple sections
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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)
|
|
64
183
|
|
|
65
184
|
## [2.3.1] - 2025-11-13
|
|
66
185
|
|
|
67
186
|
### 🔄 Changed
|
|
68
187
|
|
|
69
188
|
- **Configuration Priority** - Updated merge order: `defaults < user config < preset config`
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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)
|
|
73
192
|
|
|
74
193
|
### ✨ Added
|
|
75
194
|
|
|
76
195
|
- **Installation Diagnostics Utility** - New `lib/utils/installation-diagnostics.js`
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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.)
|
|
81
200
|
|
|
82
201
|
- **Enhanced Error Messages** - Better guidance when installation fails
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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`
|
|
86
205
|
|
|
87
206
|
- **Bash Wrapper Early Validation** - Hooks now check `.claude/` exists before attempting execution
|
|
88
|
-
|
|
89
|
-
|
|
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
|
|
90
209
|
|
|
91
210
|
- **Claude Error Diagnostics** - New `lib/utils/claude-diagnostics.js`
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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")
|
|
97
216
|
|
|
98
217
|
### 📚 Documentation
|
|
99
218
|
|
|
100
219
|
- **CUSTOMIZATION_GUIDE.md** - Comprehensive preset creation guide in `/templates`
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
107
226
|
|
|
108
227
|
- **Utility Modules Reference** - New section in README.md:596
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
|
112
231
|
|
|
113
232
|
- **README-NPM.md** - Complete rewrite for npm package page
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
118
237
|
|
|
119
238
|
### 🎯 User Experience
|
|
120
239
|
|
|
@@ -129,27 +248,27 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
|
|
|
129
248
|
### ✨ Added
|
|
130
249
|
|
|
131
250
|
- **Preset System (Phase 3)**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
|
140
259
|
|
|
141
260
|
- **CLI Enhancements**
|
|
142
|
-
|
|
143
|
-
|
|
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`)
|
|
144
263
|
|
|
145
264
|
### 🐛 Fixed
|
|
146
265
|
|
|
147
266
|
- **Critical Bug**: `prepare-commit-msg` now properly loads merged config (preset + user overrides)
|
|
148
|
-
|
|
149
|
-
|
|
267
|
+
- Was using sync default import instead of async `getConfig()`
|
|
268
|
+
- Preset settings were being ignored in commit message generation
|
|
150
269
|
- **Template Name Mismatch**: Fixed config.js template paths
|
|
151
|
-
|
|
152
|
-
|
|
270
|
+
- `COMMIT_MESSAGE.md` (was `CLAUDE_COMMIT_MESSAGE.md`)
|
|
271
|
+
- `ANALYZE_DIFF.md` (was `CLAUDE_ANALYZE_DIFF.md`)
|
|
153
272
|
- **Missing Auto-Update**: `checkVersionAndPromptUpdate()` now called during install
|
|
154
273
|
|
|
155
274
|
### 🗑️ Removed
|
|
@@ -212,45 +331,45 @@ git commit -m "message" # Now filters to .java, .xml, .yml only
|
|
|
212
331
|
### ✨ Added
|
|
213
332
|
|
|
214
333
|
- **Configuration Centralization (Phase 1)**
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
|
220
339
|
|
|
221
340
|
- **Prompt Externalization (Phase 2)**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
|
227
346
|
|
|
228
347
|
- **Parallel Analysis**
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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`
|
|
236
355
|
|
|
237
356
|
### 🔄 Changed
|
|
238
357
|
|
|
239
358
|
- **Configuration Migration**
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
|
245
364
|
|
|
246
365
|
- **Prompt Migration**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
|
250
369
|
|
|
251
370
|
- **Template Loading**
|
|
252
|
-
|
|
253
|
-
|
|
371
|
+
- 📂 Enhanced `loadTemplate()` with fallback: `.claude/` → `templates/`
|
|
372
|
+
- 🔀 Enables per-project customization of prompts
|
|
254
373
|
|
|
255
374
|
### 🗑️ Removed
|
|
256
375
|
|
|
@@ -275,6 +394,7 @@ git commit -m "message" # Now filters to .java, .xml, .yml only
|
|
|
275
394
|
No breaking changes. All defaults match previous behavior.
|
|
276
395
|
|
|
277
396
|
**Optional: Customize configuration**
|
|
397
|
+
|
|
278
398
|
```bash
|
|
279
399
|
# Create project config
|
|
280
400
|
mkdir -p .claude
|
|
@@ -296,6 +416,7 @@ EOF
|
|
|
296
416
|
```
|
|
297
417
|
|
|
298
418
|
**Optional: Customize prompts**
|
|
419
|
+
|
|
299
420
|
```bash
|
|
300
421
|
# Override commit message prompt
|
|
301
422
|
cp templates/COMMIT_MESSAGE.md .claude/
|
|
@@ -342,6 +463,7 @@ El marcador de bloque `// SKIP_ANALYSIS_BLOCK` permanece sin cambios.
|
|
|
342
463
|
|
|
343
464
|
**Why this change?**
|
|
344
465
|
The bash-based hooks created fundamental incompatibilities with Windows Git and IDE workflows (VSCode, IntelliJ), causing:
|
|
466
|
+
|
|
345
467
|
- Git worktree path conflicts (Windows paths incompatible with WSL)
|
|
346
468
|
- IDE commit failures when using Windows Git
|
|
347
469
|
- Developers forced to use WSL terminal exclusively, abandoning IDE Git features
|
|
@@ -349,16 +471,19 @@ The bash-based hooks created fundamental incompatibilities with Windows Git and
|
|
|
349
471
|
### ✅ Advantages
|
|
350
472
|
|
|
351
473
|
**Cross-Platform Native Support**
|
|
474
|
+
|
|
352
475
|
- ✅ Works with Windows Git, WSL, and Bash
|
|
353
476
|
- ✅ No more worktree path issues
|
|
354
477
|
- ✅ Single codebase for all platforms
|
|
355
478
|
|
|
356
479
|
**Dramatically Improved Maintainability**
|
|
480
|
+
|
|
357
481
|
- ✅ JavaScript/Node.js: ~60-70% of developers proficient vs ~1-2% with bash/jq/sed/awk
|
|
358
482
|
- ✅ Modern tooling: ESLint, Prettier, Jest testing framework
|
|
359
483
|
- ✅ VS Code debugging support vs echo statements
|
|
360
484
|
|
|
361
485
|
**Professional Development Practices**
|
|
486
|
+
|
|
362
487
|
- ✅ Unit and integration testing with Jest
|
|
363
488
|
- ✅ Type safety optional (TypeScript)
|
|
364
489
|
- ✅ Consistent error handling patterns
|
|
@@ -371,6 +496,7 @@ The bash-based hooks created fundamental incompatibilities with Windows Git and
|
|
|
371
496
|
### 🏆 Industry Success Cases
|
|
372
497
|
|
|
373
498
|
**Node.js Git Hooks - Proven Track Record:**
|
|
499
|
+
|
|
374
500
|
- **Husky**: 43k GitHub stars, 500+ contributors, 7M+ weekly npm downloads
|
|
375
501
|
- **lint-staged**: 12k stars, 200+ contributors
|
|
376
502
|
- **Commitizen**: 16k stars, industry standard
|
|
@@ -385,6 +511,7 @@ The bash-based hooks created fundamental incompatibilities with Windows Git and
|
|
|
385
511
|
### Migration Guide
|
|
386
512
|
|
|
387
513
|
Existing installations will continue working. To upgrade:
|
|
514
|
+
|
|
388
515
|
1. Run `claude-hooks update` to get v2.0.0
|
|
389
516
|
2. Run `claude-hooks install --force` to reinstall with Node.js hooks
|
|
390
517
|
3. No configuration changes needed - works transparently
|
|
@@ -394,27 +521,27 @@ Existing installations will continue working. To upgrade:
|
|
|
394
521
|
### Added
|
|
395
522
|
|
|
396
523
|
- 🚀 **Parallel Analysis with Subagents**
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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
|
|
401
528
|
|
|
402
529
|
- ⚙️ **Subagent Configuration Options**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
|
406
533
|
|
|
407
534
|
- ⏱️ **Execution Time Measurement**
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
|
413
540
|
|
|
414
541
|
- 🔧 **Git Worktree Support**
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
|
418
545
|
|
|
419
546
|
### Changed
|
|
420
547
|
|
|
@@ -429,14 +556,14 @@ Existing installations will continue working. To upgrade:
|
|
|
429
556
|
### Fixed
|
|
430
557
|
|
|
431
558
|
- 🔧 **Generación de prompt de resolución en modo SonarQube**
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
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
|
|
435
562
|
|
|
436
563
|
- 🎯 **Unificación de lógica de análisis**
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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
|
|
440
567
|
|
|
441
568
|
### Changed
|
|
442
569
|
|
|
@@ -448,9 +575,9 @@ Existing installations will continue working. To upgrade:
|
|
|
448
575
|
### Fixed
|
|
449
576
|
|
|
450
577
|
- 🔧 Comando `analyze-diff` ahora siempre compara con ramas origin
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
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
|
|
454
581
|
|
|
455
582
|
### Changed
|
|
456
583
|
|
|
@@ -481,13 +608,13 @@ Existing installations will continue working. To upgrade:
|
|
|
481
608
|
### Added
|
|
482
609
|
|
|
483
610
|
- 🔍 Nuevo comando `claude-hooks analyze-diff [base]` para análisis de diferencias entre ramas
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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`
|
|
491
618
|
|
|
492
619
|
### Changed
|
|
493
620
|
|
|
@@ -511,11 +638,11 @@ Existing installations will continue working. To upgrade:
|
|
|
511
638
|
### Added
|
|
512
639
|
|
|
513
640
|
- 🚫 Comentario `// SKIP-ANALYSIS` para excluir código del análisis
|
|
514
|
-
|
|
515
|
-
|
|
641
|
+
- Una línea: excluye la siguiente línea
|
|
642
|
+
- Bloque: código entre dos comentarios `// SKIP_ANALYSIS_BLOCK` es excluido
|
|
516
643
|
- 📝 Excepciones para Spring Framework en criterios de evaluación
|
|
517
|
-
|
|
518
|
-
|
|
644
|
+
- `@Autowired` no es considerado issue bloqueante (máximo severidad MAJOR)
|
|
645
|
+
- Inyección de dependencias con field injection es aceptable
|
|
519
646
|
|
|
520
647
|
### Changed
|
|
521
648
|
|