|
1 | 1 | package config |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "slices" |
4 | 5 | "strings" |
5 | 6 |
|
6 | 7 | "github.com/docker/docker-agent/pkg/config/latest" |
@@ -74,18 +75,18 @@ func MergeHooks(base, cli *latest.HooksConfig) *latest.HooksConfig { |
74 | 75 | } |
75 | 76 |
|
76 | 77 | merged := &latest.HooksConfig{ |
77 | | - PreToolUse: append(append([]latest.HookMatcherConfig{}, base.PreToolUse...), cli.PreToolUse...), |
78 | | - PostToolUse: append(append([]latest.HookMatcherConfig{}, base.PostToolUse...), cli.PostToolUse...), |
79 | | - SessionStart: append(append([]latest.HookDefinition{}, base.SessionStart...), cli.SessionStart...), |
80 | | - TurnStart: append(append([]latest.HookDefinition{}, base.TurnStart...), cli.TurnStart...), |
81 | | - BeforeLLMCall: append(append([]latest.HookDefinition{}, base.BeforeLLMCall...), cli.BeforeLLMCall...), |
82 | | - AfterLLMCall: append(append([]latest.HookDefinition{}, base.AfterLLMCall...), cli.AfterLLMCall...), |
83 | | - SessionEnd: append(append([]latest.HookDefinition{}, base.SessionEnd...), cli.SessionEnd...), |
84 | | - OnUserInput: append(append([]latest.HookDefinition{}, base.OnUserInput...), cli.OnUserInput...), |
85 | | - Stop: append(append([]latest.HookDefinition{}, base.Stop...), cli.Stop...), |
86 | | - Notification: append(append([]latest.HookDefinition{}, base.Notification...), cli.Notification...), |
87 | | - OnError: append(append([]latest.HookDefinition{}, base.OnError...), cli.OnError...), |
88 | | - OnMaxIterations: append(append([]latest.HookDefinition{}, base.OnMaxIterations...), cli.OnMaxIterations...), |
| 78 | + PreToolUse: slices.Concat(base.PreToolUse, cli.PreToolUse), |
| 79 | + PostToolUse: slices.Concat(base.PostToolUse, cli.PostToolUse), |
| 80 | + SessionStart: slices.Concat(base.SessionStart, cli.SessionStart), |
| 81 | + TurnStart: slices.Concat(base.TurnStart, cli.TurnStart), |
| 82 | + BeforeLLMCall: slices.Concat(base.BeforeLLMCall, cli.BeforeLLMCall), |
| 83 | + AfterLLMCall: slices.Concat(base.AfterLLMCall, cli.AfterLLMCall), |
| 84 | + SessionEnd: slices.Concat(base.SessionEnd, cli.SessionEnd), |
| 85 | + OnUserInput: slices.Concat(base.OnUserInput, cli.OnUserInput), |
| 86 | + Stop: slices.Concat(base.Stop, cli.Stop), |
| 87 | + Notification: slices.Concat(base.Notification, cli.Notification), |
| 88 | + OnError: slices.Concat(base.OnError, cli.OnError), |
| 89 | + OnMaxIterations: slices.Concat(base.OnMaxIterations, cli.OnMaxIterations), |
89 | 90 | } |
90 | 91 | return merged |
91 | 92 | } |
|
0 commit comments