package cmd import ( "github.com/fatih/color" "github.com/spf13/cobra" "gmgauthier.com/grokkit/config" ) var commitMsgCmd = &cobra.Command{ Use: "commit-msg", Short: "Generate conventional commit message from staged changes", Run: runCommitMsg, } func runCommitMsg(cmd *cobra.Command, args []string) { diff, err := gitRun([]string{"diff", "--cached", "--no-color"}) if err != nil { color.Red("Failed to get staged changes: %v", err) return } if diff == "" { color.Yellow("No staged changes!") return } modelFlag, _ := cmd.Flags().GetString("model") model := config.GetModel("commitmsg", modelFlag) client := newGrokClient() messages := buildCommitMessages(diff) color.Yellow("Generating commit message...") client.Stream(messages, model) }