Add config-based close hooks (bd-g4b4)

Implements on_close hooks in .beads/config.yaml for automation and
notifications. Hooks receive issue data via environment variables
(BEAD_ID, BEAD_TITLE, BEAD_TYPE, BEAD_PRIORITY, BEAD_CLOSE_REASON)
and run via sh -c.

Changes:
- internal/config: Add HookEntry type and GetCloseHooks()
- internal/hooks: Add RunConfigCloseHooks() for executing config hooks
- cmd/bd: Call RunConfigCloseHooks after successful close
- docs/CONFIG.md: Document hooks configuration with examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 13:38:09 -08:00
parent bc0973bfa2
commit c46b1a0bbb
5 changed files with 449 additions and 2 deletions

View File

@@ -1057,6 +1057,8 @@ var closeCmd = &cobra.Command{
if hookRunner != nil {
hookRunner.Run(hooks.EventClose, &issue)
}
// Run config-based close hooks (bd-g4b4)
hooks.RunConfigCloseHooks(ctx, &issue)
if jsonOutput {
closedIssues = append(closedIssues, &issue)
}
@@ -1109,8 +1111,12 @@ var closeCmd = &cobra.Command{
// Run close hook (bd-kwro.8)
closedIssue, _ := store.GetIssue(ctx, id)
if closedIssue != nil && hookRunner != nil {
hookRunner.Run(hooks.EventClose, closedIssue)
if closedIssue != nil {
if hookRunner != nil {
hookRunner.Run(hooks.EventClose, closedIssue)
}
// Run config-based close hooks (bd-g4b4)
hooks.RunConfigCloseHooks(ctx, closedIssue)
}
if jsonOutput {