claude-git-hooks 2.6.2 → 2.6.3

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 CHANGED
@@ -5,6 +5,28 @@ 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.6.3]
9
+
10
+ ### 🐛 Fixed
11
+
12
+ - **WSL timeout error misreporting** - Fixed misleading error message when WSL times out under system load (#49)
13
+ - **What was broken**: ETIMEDOUT errors during WSL Claude verification were misreported as "Claude CLI not found in WSL"
14
+ - **Root cause**: Catch block in WSL verification treated all errors identically, including transient ETIMEDOUT timeouts from system load
15
+ - **Fix**: Added error type differentiation to distinguish between ETIMEDOUT (transient timeout), ENOENT (missing CLI), and generic WSL errors
16
+ - **Files changed**:
17
+ - `lib/utils/claude-client.js:109-146` - Enhanced error detection with three distinct error paths
18
+ - **Impact**:
19
+ - ETIMEDOUT: Clear message "Timeout connecting to WSL - system under heavy load" with suggestion to retry or skip
20
+ - ENOENT: Preserved original "Claude CLI not found in WSL" with installation instructions
21
+ - Generic: New fallback "Failed to verify Claude CLI in WSL" with WSL diagnostic suggestions
22
+ - **Compatibility**: No breaking changes, improves error accuracy for Windows WSL users
23
+
24
+ ### 🎯 User Experience
25
+
26
+ - **Before**: Users experiencing system load timeouts saw misleading "Claude CLI not found" error and tried reinstalling unnecessarily
27
+ - **After**: Clear distinction between transient timeouts (retry/skip) and missing CLI (install) with actionable suggestions for each
28
+ - **Debug**: All error cases now include context with platform, wslPath, error type, and specific remediation steps
29
+
8
30
  ## [2.6.2] - 2025-12-12
9
31
 
10
32
  ### 🐛 Fixed
@@ -118,11 +140,13 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
118
140
  ### 🔧 Technical Details
119
141
 
120
142
  **DEP0190 Explanation**:
143
+
121
144
  - **What**: Node.js 24 deprecates `spawn(cmd, args, { shell: true })`
122
145
  - **Why**: Args are not escaped, just concatenated → shell injection risk
123
146
  - **Fix**: Use absolute executable paths, remove `shell: true`
124
147
 
125
148
  **Files Changed**:
149
+
126
150
  - `lib/utils/claude-client.js` - Command resolution and spawn call
127
151
  - `lib/utils/which-command.js` - NEW utility for path resolution
128
152
  - `package.json` - Platform documentation
@@ -131,6 +155,7 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
131
155
  - `MIGRATION_NODE24.md` - NEW migration guide
132
156
 
133
157
  **Backward Compatibility**:
158
+
134
159
  - ✅ Works on Node 16.9.0+ (unchanged)
135
160
  - ✅ Works on Node 18 (unchanged)
136
161
  - ✅ Works on Node 20 (unchanged)
@@ -149,6 +174,7 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
149
174
  ### 📋 Migration Checklist
150
175
 
151
176
  For users on Node 24:
177
+
152
178
  - [x] Update to claude-git-hooks 2.6.0
153
179
  - [x] Verify no DEP0190 warnings: `claude-hooks install`
154
180
  - [x] Test pre-commit hook: `git commit`
@@ -107,11 +107,40 @@ const getClaudeCommand = () => {
107
107
  logger.debug('claude-client - getClaudeCommand', 'Using WSL Claude CLI', { wslPath });
108
108
  return { command: wslPath, args: ['claude'] };
109
109
  } catch (wslError) {
110
- throw new ClaudeClientError('Claude CLI not found in WSL', {
110
+ // Differentiate error types for accurate user feedback
111
+ const errorMsg = wslError.message || '';
112
+
113
+ // Timeout: Transient system load issue
114
+ if (errorMsg.includes('ETIMEDOUT')) {
115
+ throw new ClaudeClientError('Timeout connecting to WSL - system under heavy load', {
116
+ context: {
117
+ platform: 'Windows',
118
+ wslPath,
119
+ error: 'ETIMEDOUT',
120
+ suggestion: 'System is busy. Wait a moment and try again, or skip analysis: git commit --no-verify'
121
+ }
122
+ });
123
+ }
124
+
125
+ // Not found: Claude CLI missing in WSL
126
+ if (errorMsg.includes('ENOENT') || errorMsg.includes('command not found')) {
127
+ throw new ClaudeClientError('Claude CLI not found in WSL', {
128
+ context: {
129
+ platform: 'Windows',
130
+ wslPath,
131
+ error: 'ENOENT',
132
+ suggestion: 'Install Claude in WSL: wsl -e bash -c "npm install -g @anthropic-ai/claude-cli"'
133
+ }
134
+ });
135
+ }
136
+
137
+ // Generic error: Other WSL issues
138
+ throw new ClaudeClientError('Failed to verify Claude CLI in WSL', {
111
139
  context: {
112
140
  platform: 'Windows',
113
141
  wslPath,
114
- wslError: wslError.message
142
+ error: errorMsg,
143
+ suggestion: 'Check WSL is functioning: wsl --version, or skip analysis: git commit --no-verify'
115
144
  }
116
145
  });
117
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-git-hooks",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "Git hooks with Claude CLI for code analysis and automatic commit messages",
5
5
  "type": "module",
6
6
  "bin": {