feat: add native Codex hook integration

This commit is contained in:
ZacharyZhang-NY committed 2026-07-19 05:48:24 -04:00
1 parent 758d129dbf
commit dfddb02f66
10 files changed
+925 -84

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
package plugins
import (
"fmt"
"os"
"path/filepath"
)
func codexConfigPath() (string, error) {
home, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("resolve home directory: %w", err)
}
return filepath.Join(home, ".codex", "hooks.json"), nil
}
func codexHandler(runtimePath, scriptPath, statusMessage string) map[string]any {
return map[string]any{
"type": "command",
"command": quotePOSIXArgument(runtimePath) + " " + quotePOSIXArgument(scriptPath),
"commandWindows": quoteWindowsArgument(runtimePath) + " " + quoteWindowsArgument(scriptPath),
"timeout": 10,
"statusMessage": statusMessage,
}
}
func codexMatcherGroup(handler map[string]any) map[string]any {
return map[string]any{
"matcher": "*",
"hooks": []any{handler},
}
}