claude-git-hooks 2.6.1 → 2.6.2
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 +22 -0
- package/lib/utils/claude-client.js +28 -1
- package/package.json +1 -1
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.2] - 2025-12-12
|
|
9
|
+
|
|
10
|
+
### 🐛 Fixed
|
|
11
|
+
|
|
12
|
+
- **Parallel analysis stdin error handling** - Added graceful error handling for EOF errors during parallel execution (#43)
|
|
13
|
+
- **What was broken**: Unhandled 'error' events on stdin stream when Claude CLI process terminates unexpectedly during parallel analysis
|
|
14
|
+
- **Root cause**: `stdin.write()` failures emit asynchronous 'error' events that weren't being caught, causing uncaught exceptions with large prompts (18+ files) in parallel mode
|
|
15
|
+
- **Fix**: Added explicit error handler on `stdin` stream before writing prompt
|
|
16
|
+
- **Files changed**:
|
|
17
|
+
- `lib/utils/claude-client.js:287-308` - Added stdin error handler with detailed diagnostics
|
|
18
|
+
- **Impact**:
|
|
19
|
+
- Provides clear error message: "Failed to write to Claude stdin - process terminated unexpectedly"
|
|
20
|
+
- Logs diagnostic info: prompt length, error code, duration
|
|
21
|
+
- Suggests actionable fix: "Try reducing batch size or number of files per commit"
|
|
22
|
+
- **Compatibility**: No breaking changes, improves error reporting for all platforms
|
|
23
|
+
|
|
24
|
+
### 🎯 User Experience
|
|
25
|
+
|
|
26
|
+
- **Before**: Cryptic unhandled 'write EOF' exceptions crashed commit process with no actionable information
|
|
27
|
+
- **After**: Clear error message with diagnostic context and suggested remediation
|
|
28
|
+
- **Debug**: Added structured logging with prompt length and timing when EOF errors occur
|
|
29
|
+
|
|
8
30
|
## [2.6.1] - 2025-12-04
|
|
9
31
|
|
|
10
32
|
### 🐛 Fixed
|
|
@@ -280,13 +280,40 @@ const executeClaude = (prompt, { timeout = 120000, allowedTools = [] } = {}) =>
|
|
|
280
280
|
|
|
281
281
|
// Write prompt to stdin
|
|
282
282
|
// Why: Claude CLI reads prompt from stdin, not command arguments
|
|
283
|
+
|
|
284
|
+
// Handle stdin errors (e.g., EOF when process terminates unexpectedly)
|
|
285
|
+
// Why: write() failures can emit 'error' events asynchronously
|
|
286
|
+
// Common in parallel execution with large prompts
|
|
287
|
+
claude.stdin.on('error', (error) => {
|
|
288
|
+
logger.error(
|
|
289
|
+
'claude-client - executeClaude',
|
|
290
|
+
'stdin stream error (process may have terminated early)',
|
|
291
|
+
{
|
|
292
|
+
error: error.message,
|
|
293
|
+
code: error.code,
|
|
294
|
+
promptLength: prompt.length,
|
|
295
|
+
duration: Date.now() - startTime
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
reject(new ClaudeClientError('Failed to write to Claude stdin - process terminated unexpectedly', {
|
|
300
|
+
cause: error,
|
|
301
|
+
context: {
|
|
302
|
+
promptLength: prompt.length,
|
|
303
|
+
errorCode: error.code,
|
|
304
|
+
errorMessage: error.message,
|
|
305
|
+
suggestion: 'Try reducing batch size or number of files per commit'
|
|
306
|
+
}
|
|
307
|
+
}));
|
|
308
|
+
});
|
|
309
|
+
|
|
283
310
|
try {
|
|
284
311
|
claude.stdin.write(prompt);
|
|
285
312
|
claude.stdin.end();
|
|
286
313
|
} catch (error) {
|
|
287
314
|
logger.error(
|
|
288
315
|
'claude-client - executeClaude',
|
|
289
|
-
'Failed to write prompt to Claude CLI stdin',
|
|
316
|
+
'Failed to write prompt to Claude CLI stdin (synchronous error)',
|
|
290
317
|
error
|
|
291
318
|
);
|
|
292
319
|
|