start-vibing 2.0.4 → 2.0.6
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 +1 -1
- package/template/.claude/hooks/run-hook.ts +22 -8
- package/template/.claude/hooks/stop-validator.ts +19 -5
- package/template/.claude/hooks/user-prompt-submit.py +574 -169
- package/template/.claude/hooks/user-prompt-submit.ts +597 -101
- package/template/.claude/settings.json +2 -2
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Universal Hook Runner
|
|
4
4
|
*
|
|
5
5
|
* Runs hooks with multiple runtime fallbacks:
|
|
6
6
|
* 1. python3 (primary - user's preferred)
|
|
7
7
|
* 2. python (fallback)
|
|
8
|
-
* 3.
|
|
9
|
-
* 4. npx tsx (final fallback)
|
|
8
|
+
* 3. npx tsx (TypeScript execution)
|
|
10
9
|
*
|
|
11
|
-
* Usage:
|
|
10
|
+
* Usage: npx tsx run-hook.ts <hook-name>
|
|
12
11
|
* The hook-name should be without extension (e.g., "stop-validator")
|
|
13
12
|
*/
|
|
14
13
|
|
|
@@ -120,15 +119,30 @@ async function runHook(hookName: string, stdinData: string): Promise<void> {
|
|
|
120
119
|
|
|
121
120
|
async function readStdinWithTimeout(timeoutMs: number): Promise<string> {
|
|
122
121
|
return new Promise((resolve) => {
|
|
123
|
-
const timeout = setTimeout(() =>
|
|
122
|
+
const timeout = setTimeout(() => {
|
|
123
|
+
process.stdin.destroy();
|
|
124
|
+
resolve('{}');
|
|
125
|
+
}, timeoutMs);
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
let data = '';
|
|
128
|
+
process.stdin.setEncoding('utf8');
|
|
129
|
+
process.stdin.on('data', (chunk: string) => {
|
|
130
|
+
data += chunk;
|
|
131
|
+
});
|
|
132
|
+
process.stdin.on('end', () => {
|
|
126
133
|
clearTimeout(timeout);
|
|
127
|
-
resolve(
|
|
128
|
-
})
|
|
134
|
+
resolve(data || '{}');
|
|
135
|
+
});
|
|
136
|
+
process.stdin.on('error', () => {
|
|
129
137
|
clearTimeout(timeout);
|
|
130
138
|
resolve('{}');
|
|
131
139
|
});
|
|
140
|
+
|
|
141
|
+
// Handle case where stdin is empty/closed immediately
|
|
142
|
+
if (process.stdin.readableEnded) {
|
|
143
|
+
clearTimeout(timeout);
|
|
144
|
+
resolve('{}');
|
|
145
|
+
}
|
|
132
146
|
});
|
|
133
147
|
}
|
|
134
148
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Stop Validator Hook - TypeScript version (fallback when Python not available)
|
|
4
4
|
*
|
|
@@ -178,15 +178,29 @@ interface HookResult {
|
|
|
178
178
|
|
|
179
179
|
async function readStdinWithTimeout(timeoutMs: number): Promise<string> {
|
|
180
180
|
return new Promise((resolve) => {
|
|
181
|
-
const timeout = setTimeout(() =>
|
|
181
|
+
const timeout = setTimeout(() => {
|
|
182
|
+
process.stdin.destroy();
|
|
183
|
+
resolve('{}');
|
|
184
|
+
}, timeoutMs);
|
|
182
185
|
|
|
183
|
-
|
|
186
|
+
let data = '';
|
|
187
|
+
process.stdin.setEncoding('utf8');
|
|
188
|
+
process.stdin.on('data', (chunk: string) => {
|
|
189
|
+
data += chunk;
|
|
190
|
+
});
|
|
191
|
+
process.stdin.on('end', () => {
|
|
184
192
|
clearTimeout(timeout);
|
|
185
|
-
resolve(
|
|
186
|
-
})
|
|
193
|
+
resolve(data || '{}');
|
|
194
|
+
});
|
|
195
|
+
process.stdin.on('error', () => {
|
|
187
196
|
clearTimeout(timeout);
|
|
188
197
|
resolve('{}');
|
|
189
198
|
});
|
|
199
|
+
|
|
200
|
+
if (process.stdin.readableEnded) {
|
|
201
|
+
clearTimeout(timeout);
|
|
202
|
+
resolve('{}');
|
|
203
|
+
}
|
|
190
204
|
});
|
|
191
205
|
}
|
|
192
206
|
|