fixup! chore: update marketplace for v0.11.37

march-improvements
This commit is contained in:
2026-03-06 15:39:52 +00:00
parent 1a6f6b6e5e
commit 77f5f02510
32 changed files with 2403 additions and 2777 deletions
+11 -1
View File
@@ -2,6 +2,7 @@
package hooks
import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
@@ -9,6 +10,7 @@ import (
"io"
"os"
"path/filepath"
"time"
)
// HookResponse is the response sent back to Claude Code.
@@ -31,6 +33,14 @@ func ProjectIDWithName(cwd string) string {
return fmt.Sprintf("%s_%s", dirName, shortHash)
}
// HookDeadline returns a context with the hook's timeout budget minus a safety margin.
// This ensures hooks return gracefully before Claude kills them.
func HookDeadline(timeout time.Duration) (context.Context, context.CancelFunc) {
// Use 80% of the timeout to leave margin for response serialization
safeTimeout := time.Duration(float64(timeout) * 0.8)
return context.WithTimeout(context.Background(), safeTimeout)
}
// Exit codes for Claude Code hooks
const (
ExitSuccess = 0
@@ -92,7 +102,7 @@ func RunHook[T any](hookName string, handler HookHandler[T]) {
// Parse input
var input T
if err := json.Unmarshal(inputData, &input); err != nil {
if err = json.Unmarshal(inputData, &input); err != nil {
WriteError(hookName, err)
os.Exit(1)
}