grokkit/cmd/history.go

28 lines
705 B
Go
Raw Normal View History

2026-02-28 18:03:12 +00:00
package cmd
2026-02-28 18:28:27 +00:00
2026-02-28 19:56:23 +00:00
import (
"github.com/fatih/color"
"github.com/spf13/cobra"
"gmgauthier.com/grokkit/internal/git"
"gmgauthier.com/grokkit/internal/grok"
)
2026-02-28 18:28:27 +00:00
var historyCmd = &cobra.Command{
Use: "history",
Short: "Summarize recent git history",
Run: func(cmd *cobra.Command, args []string) {
log := git.Run([]string{"log", "--oneline", "-10"})
if log == "" {
color.Yellow("No commits found.")
return
2026-02-28 19:56:23 +00:00
}
client := grok.NewClient()
2026-02-28 19:56:23 +00:00
messages := []map[string]string{
{"role": "system", "content": "Summarize the recent git history in 3-5 bullet points."},
{"role": "user", "content": log},
2026-02-28 19:56:23 +00:00
}
color.Yellow("Summarizing recent commits...")
client.Stream(messages, "grok-4")
2026-02-28 18:28:27 +00:00
},
}