start-vibing 2.0.19 → 2.0.20
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
|
@@ -171,17 +171,22 @@ async function readStdinWithTimeout(timeoutMs: number): Promise<string> {
|
|
|
171
171
|
|
|
172
172
|
// Main
|
|
173
173
|
async function main(): Promise<void> {
|
|
174
|
+
// Log hook invocation for debugging (writes to stderr so it doesn't affect JSON output)
|
|
175
|
+
const hookName = process.argv[2];
|
|
176
|
+
const timestamp = new Date().toISOString();
|
|
177
|
+
console.error(`[run-hook] ${timestamp} - Hook invoked: ${hookName || 'none'}`);
|
|
178
|
+
|
|
174
179
|
// Clean up deprecated files on every hook run
|
|
175
180
|
cleanupDeprecatedFiles();
|
|
176
181
|
|
|
177
|
-
const hookName = process.argv[2];
|
|
178
182
|
if (!hookName) {
|
|
179
|
-
console.error('Usage: bun run-hook.ts <hook-name>');
|
|
183
|
+
console.error('[run-hook] Usage: bun run-hook.ts <hook-name>');
|
|
180
184
|
process.exit(1);
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
// Read stdin with timeout to avoid hanging
|
|
184
188
|
const stdinData = await readStdinWithTimeout(2000);
|
|
189
|
+
console.error(`[run-hook] ${hookName} - stdin received, length: ${stdinData.length}`);
|
|
185
190
|
await runHook(hookName, stdinData);
|
|
186
191
|
}
|
|
187
192
|
|
|
@@ -965,11 +965,20 @@ async function readStdinWithTimeout(timeoutMs: number): Promise<string> {
|
|
|
965
965
|
}
|
|
966
966
|
|
|
967
967
|
async function main(): Promise<void> {
|
|
968
|
+
// Debug logging - always output to stderr for visibility
|
|
969
|
+
console.error('[stop-validator] ========================================');
|
|
970
|
+
console.error('[stop-validator] Starting validation...');
|
|
971
|
+
console.error(`[stop-validator] CWD: ${process.cwd()}`);
|
|
972
|
+
console.error(`[stop-validator] PROJECT_DIR: ${PROJECT_DIR}`);
|
|
973
|
+
console.error(`[stop-validator] CLAUDE_MD exists: ${existsSync(CLAUDE_MD_PATH)}`);
|
|
974
|
+
|
|
968
975
|
let hookInput: HookInput = {};
|
|
969
976
|
try {
|
|
970
977
|
const stdin = await readStdinWithTimeout(1000);
|
|
978
|
+
console.error(`[stop-validator] stdin received: ${stdin.length} chars`);
|
|
971
979
|
if (stdin && stdin.trim()) {
|
|
972
980
|
hookInput = JSON.parse(stdin);
|
|
981
|
+
console.error(`[stop-validator] Parsed input keys: ${Object.keys(hookInput).join(', ') || 'none'}`);
|
|
973
982
|
}
|
|
974
983
|
} catch {
|
|
975
984
|
hookInput = {};
|
|
@@ -993,6 +1002,11 @@ async function main(): Promise<void> {
|
|
|
993
1002
|
const isCleanTree = modifiedFiles.length === 0;
|
|
994
1003
|
|
|
995
1004
|
// Run all validations
|
|
1005
|
+
console.error('[stop-validator] Running validations...');
|
|
1006
|
+
console.error(`[stop-validator] Branch: ${currentBranch}, isMain: ${isMainBranch}`);
|
|
1007
|
+
console.error(`[stop-validator] Modified files: ${modifiedFiles.length}`);
|
|
1008
|
+
console.error(`[stop-validator] Source files: ${sourceFiles.length}`);
|
|
1009
|
+
|
|
996
1010
|
const errors: ValidationError[] = [];
|
|
997
1011
|
|
|
998
1012
|
// Validation order matters - most critical first
|
|
@@ -1036,6 +1050,11 @@ async function main(): Promise<void> {
|
|
|
1036
1050
|
// OUTPUT RESULTS
|
|
1037
1051
|
// ============================================================================
|
|
1038
1052
|
|
|
1053
|
+
console.error(`[stop-validator] Validation complete. Errors found: ${errors.length}`);
|
|
1054
|
+
if (errors.length > 0) {
|
|
1055
|
+
console.error(`[stop-validator] Error types: ${errors.map((e) => e.type).join(', ')}`);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1039
1058
|
if (errors.length > 0) {
|
|
1040
1059
|
let output = `
|
|
1041
1060
|
################################################################################
|
|
@@ -1073,9 +1092,10 @@ Before completing, ask yourself:
|
|
|
1073
1092
|
Update CLAUDE.md with any learnings from this session.
|
|
1074
1093
|
`;
|
|
1075
1094
|
|
|
1095
|
+
// IMPORTANT: For blocking, output to STDERR and exit with code 2
|
|
1076
1096
|
const result: HookResult = { decision: 'block', reason: output.trim() };
|
|
1077
|
-
console.
|
|
1078
|
-
process.exit(
|
|
1097
|
+
console.error(JSON.stringify(result));
|
|
1098
|
+
process.exit(2); // Exit code 2 = block and show to Claude
|
|
1079
1099
|
}
|
|
1080
1100
|
|
|
1081
1101
|
// All validations passed
|