start-vibing 2.0.32 → 2.0.34
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/package.json
CHANGED
|
@@ -1225,7 +1225,7 @@ WORKFLOW
|
|
|
1225
1225
|
// continue: true tells Claude to KEEP WORKING after receiving this block
|
|
1226
1226
|
const result: HookResult = { continue: true, decision: 'block', reason: blockReason.trim() };
|
|
1227
1227
|
console.log(JSON.stringify(result));
|
|
1228
|
-
process.exit(
|
|
1228
|
+
process.exit(0); // Must be 0 for JSON to be processed - exit 2 ignores JSON!
|
|
1229
1229
|
}
|
|
1230
1230
|
|
|
1231
1231
|
// All validations passed
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Last Update
|
|
4
4
|
|
|
5
|
-
- **Date:** 2026-01-
|
|
6
|
-
- **Commit:**
|
|
7
|
-
- **Session:**
|
|
5
|
+
- **Date:** 2026-01-06
|
|
6
|
+
- **Commit:** 77e2263
|
|
7
|
+
- **Session:** Fixed stop hook exit code from 2 to 0 for proper JSON processing
|
|
8
8
|
|
|
9
9
|
## Files
|
|
10
10
|
|
|
@@ -86,14 +86,45 @@
|
|
|
86
86
|
|
|
87
87
|
| Hash | Date | Description |
|
|
88
88
|
| ------- | ---------- | --------------------------------------------------------------------- |
|
|
89
|
+
| 77e2263 | 2026-01-06 | fix: stop hook exit code from 2 to 0 for JSON processing |
|
|
89
90
|
| d429772 | 2026-01-03 | feat(agents): restructure agent system with 82 specialized sub-agents |
|
|
90
91
|
| 70ca50f | 2026-01-02 | feat(start-vibing): auto-install Claude Code and self-update |
|
|
91
92
|
| 5c74c95 | 2026-01-02 | feat: add specialized agents and progressive disclosure to skills |
|
|
92
93
|
| b5c483b | 2026-01-02 | docs: add agents/skills comparison research with industry benchmarks |
|
|
93
|
-
| 0f2c1ff | 2026-01-02 | fix: block ALL changes on main branch, not just protected files |
|
|
94
94
|
|
|
95
95
|
## Problems & Solutions
|
|
96
96
|
|
|
97
|
+
### 2026-01-06 - Stop Hook Exit Code Fix
|
|
98
|
+
|
|
99
|
+
**Problem:**
|
|
100
|
+
When stop hook blocked task completion, Claude was just stopping instead of continuing to fix the issues. The message "Stop hook prevented continuation" appeared but Claude didn't take action.
|
|
101
|
+
|
|
102
|
+
**Root Cause:**
|
|
103
|
+
Stop hook was using `process.exit(2)` which causes Claude Code to **ignore the JSON output**. The `decision: "block"` with `reason` was being sent correctly, but exit code 2 made Claude ignore it and only show stderr.
|
|
104
|
+
|
|
105
|
+
**Solution:**
|
|
106
|
+
Changed exit code from 2 to 0 in `stop-validator.ts`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Before: process.exit(2);
|
|
110
|
+
process.exit(0); // Must be 0 for JSON to be processed!
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Key Insight:**
|
|
114
|
+
- Exit code 0: JSON stdout is processed (decision, reason fields work)
|
|
115
|
+
- Exit code 2: JSON stdout is IGNORED, only stderr shown
|
|
116
|
+
|
|
117
|
+
**Files Modified:**
|
|
118
|
+
- `.claude/hooks/stop-validator.ts` - Changed exit(2) to exit(0) on line 1228
|
|
119
|
+
- `.claude/skills/hook-development/SKILL.md` - Updated documentation with correct exit code guidance
|
|
120
|
+
|
|
121
|
+
**Prevention:**
|
|
122
|
+
- Always use exit(0) for Stop hooks that want Claude to continue
|
|
123
|
+
- Use `decision: "block"` in JSON to block, not exit code 2
|
|
124
|
+
- Exit code 2 is only for PreToolUse hooks (blocks specific tool call)
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
97
128
|
### 2026-01-03 - Universal Hook Runner with Multi-Runtime Fallback
|
|
98
129
|
|
|
99
130
|
**Problem:**
|
|
@@ -107,10 +107,12 @@ Event-specific fields:
|
|
|
107
107
|
|
|
108
108
|
| Code | Meaning | Behavior |
|
|
109
109
|
|------|---------|----------|
|
|
110
|
-
| 0 | Success | stdout
|
|
111
|
-
| 2 | Blocking error | stderr
|
|
110
|
+
| 0 | Success | JSON stdout is processed (decision, reason, continue fields) |
|
|
111
|
+
| 2 | Blocking error | JSON stdout is IGNORED, only stderr shown to Claude |
|
|
112
112
|
| Other | Non-blocking error | Hook failed, but doesn't block |
|
|
113
113
|
|
|
114
|
+
**IMPORTANT for Stop Hooks:** To make Claude CONTINUE working after a block, use exit(0) with `decision: "block"` in JSON. Exit code 2 ignores JSON, so Claude just stops instead of fixing issues.
|
|
115
|
+
|
|
114
116
|
---
|
|
115
117
|
|
|
116
118
|
## Environment Variables
|
|
@@ -164,13 +166,20 @@ const cmd = `cat ${filePath}`; // WRONG - injection risk
|
|
|
164
166
|
### Error Handling
|
|
165
167
|
|
|
166
168
|
```typescript
|
|
167
|
-
// For
|
|
169
|
+
// For Stop hooks - use JSON with decision: "block" + exit(0)
|
|
170
|
+
// This makes Claude CONTINUE working to fix the issues
|
|
168
171
|
if (validationFailed) {
|
|
169
|
-
|
|
170
|
-
process.exit(
|
|
172
|
+
console.log(JSON.stringify({ decision: 'block', reason: errorMessage }));
|
|
173
|
+
process.exit(0); // Must be 0 for JSON to be processed!
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// For PreToolUse hooks - exit(2) blocks the specific tool operation
|
|
177
|
+
if (dangerousOperation) {
|
|
178
|
+
process.stderr.write('BLOCKED: Dangerous operation');
|
|
179
|
+
process.exit(2); // Blocks this tool call only
|
|
171
180
|
}
|
|
172
181
|
|
|
173
|
-
// For non-blocking
|
|
182
|
+
// For non-blocking warnings
|
|
174
183
|
if (warningCondition) {
|
|
175
184
|
console.error('Warning:', message);
|
|
176
185
|
process.exit(1); // Logs but doesn't block
|
|
@@ -199,20 +208,24 @@ async function main(): Promise<void> {
|
|
|
199
208
|
const error = validateSomething();
|
|
200
209
|
|
|
201
210
|
if (error) {
|
|
202
|
-
// Block
|
|
203
|
-
|
|
211
|
+
// Block and make Claude CONTINUE working to fix the issue
|
|
212
|
+
// IMPORTANT: Use exit(0) so JSON is processed. exit(2) ignores JSON!
|
|
213
|
+
const result: HookResult = {
|
|
214
|
+
decision: 'block',
|
|
215
|
+
reason: `
|
|
204
216
|
ERROR: ${error.type}
|
|
205
217
|
|
|
206
218
|
${error.message}
|
|
207
219
|
|
|
208
220
|
REQUIRED ACTION:
|
|
209
221
|
Task(subagent_type="${error.agent}", prompt="${error.prompt}")
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
222
|
+
`
|
|
223
|
+
};
|
|
224
|
+
console.log(JSON.stringify(result));
|
|
225
|
+
process.exit(0); // Must be 0 for JSON to be processed!
|
|
213
226
|
}
|
|
214
227
|
|
|
215
|
-
// Success
|
|
228
|
+
// Success - allow task completion
|
|
216
229
|
const result: HookResult = { decision: 'approve', reason: 'All checks passed' };
|
|
217
230
|
console.log(JSON.stringify(result));
|
|
218
231
|
process.exit(0);
|
|
@@ -289,8 +302,12 @@ const validations = [
|
|
|
289
302
|
|
|
290
303
|
const firstError = validations.find(v => v !== null);
|
|
291
304
|
if (firstError) {
|
|
292
|
-
|
|
293
|
-
|
|
305
|
+
// Use JSON with decision: "block" + exit(0) so Claude CONTINUES fixing
|
|
306
|
+
console.log(JSON.stringify({
|
|
307
|
+
decision: 'block',
|
|
308
|
+
reason: formatError(firstError)
|
|
309
|
+
}));
|
|
310
|
+
process.exit(0); // NOT exit(2) - that ignores JSON!
|
|
294
311
|
}
|
|
295
312
|
```
|
|
296
313
|
|