chore: crush git history - reborn from consolidation on 2026-03-10

This commit is contained in:
John Dvorak
2026-03-10 00:00:00 -07:00
commit d278c4b105
313 changed files with 87549 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
/**
* Hook Timeout Utility
*
* Wraps async operations with a timeout to prevent indefinite hangs.
*/
export class HookTimeoutError extends Error {
constructor(extensionName: string, hookName: string, timeoutMs: number) {
super(
`Extension '${extensionName}' ${hookName} timed out after ${timeoutMs}ms. ` +
`Consider increasing hookTimeoutMs or investigating the extension for blocking operations.`
)
this.name = 'HookTimeoutError'
}
}
/**
* Wrap a promise with a timeout.
* @returns Promise that rejects with HookTimeoutError if deadline exceeded
*/
export function withTimeout<T>(
promise: Promise<T>,
timeoutMs: number,
extensionName: string,
hookName: string
): Promise<T> {
if (timeoutMs <= 0) {
return promise
}
return Promise.race([
promise,
new Promise<never>((_, reject) => {
setTimeout(() => {
reject(new HookTimeoutError(extensionName, hookName, timeoutMs))
}, timeoutMs)
}),
])
}