feat: add native Codex hook integration
This commit is contained in:
1 parent
758d129dbf
commit
dfddb02f66
10 files changed
+925
-84
No files matched your search
@@ -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},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user