RunHook executes the named hook with the given project root
(hookName, root string)
| 227 | |
| 228 | // RunHook executes the named hook with the given project root |
| 229 | func RunHook(hookName, root string) error { |
| 230 | switch hookName { |
| 231 | case "session-start": |
| 232 | return hookSessionStart(root) |
| 233 | case "pre-edit": |
| 234 | return hookPreEdit(root) |
| 235 | case "post-edit": |
| 236 | return hookPostEdit(root) |
| 237 | case "prompt-submit": |
| 238 | return hookPromptSubmit(root) |
| 239 | case "pre-compact": |
| 240 | return hookPreCompact(root) |
| 241 | case "session-stop": |
| 242 | return hookSessionStop(root) |
| 243 | default: |
| 244 | return fmt.Errorf("unknown hook: %s\nAvailable: session-start, pre-edit, post-edit, prompt-submit, pre-compact, session-stop", hookName) |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | // hookSessionStart shows project structure, starts daemon, and shows hub warnings |
| 249 | func hookSessionStart(root string) error { |