MCPcopy Create free account
hub / github.com/compozy/agh / newAutomationTriggersUpdateCommand

Function newAutomationTriggersUpdateCommand

internal/cli/automation.go:622–690  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

620}
621
622func newAutomationTriggersUpdateCommand(deps commandDeps) *cobra.Command {
623 var (
624 name string
625 agentName string
626 workspaceRef string
627 prompt string
628 eventRaw string
629 filterFlags []string
630 retryRaw string
631 enabled bool
632 webhookID string
633 endpointSlug string
634 webhookSecretValue string
635 )
636
637 cmd := &cobra.Command{
638 Use: automationUpdateIDValue,
639 Short: "Update an automation trigger",
640 Args: exactOneNonBlankArg(),
641 RunE: func(cmd *cobra.Command, args []string) error {
642 client, err := clientFromDeps(deps)
643 if err != nil {
644 return err
645 }
646
647 request, err := buildAutomationTriggerUpdateRequest(
648 cmd,
649 client,
650 automationTriggerCommandInput{
651 Name: name,
652 EventRaw: eventRaw,
653 WorkspaceRef: workspaceRef,
654 AgentName: agentName,
655 Prompt: prompt,
656 RetryRaw: retryRaw,
657 FilterFlags: filterFlags,
658 Enabled: enabled,
659 WebhookID: webhookID,
660 EndpointSlug: endpointSlug,
661 WebhookSecretValue: webhookSecretValue,
662 },
663 )
664 if err != nil {
665 return err
666 }
667
668 updated, err := client.UpdateAutomationTrigger(cmd.Context(), args[0], request)
669 if err != nil {
670 return err
671 }
672 return writeCommandOutput(cmd, automationTriggerBundle(updated))
673 },
674 }
675 cmd.Flags().StringVar(&name, automationNameKey, "", "Update the trigger name")
676 cmd.Flags().StringVar(&agentName, "agent", "", "Update the agent definition")
677 cmd.Flags().StringVar(&workspaceRef, "workspace", "", "Update the workspace path, name, or ID")
678 cmd.Flags().StringVar(&prompt, automationPromptKey, "", "Update the prompt template body")
679 cmd.Flags().StringVar(&eventRaw, automationEventKey, "", "Update the trigger event")

Callers 1

Calls 6

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
automationTriggerBundleFunction · 0.85

Tested by

no test coverage detected