2026-02-28 22:47:30 +00:00
|
|
|
// Last modified: 2026-02-28 22:43:46 GMT
|
2026-02-28 22:29:16 +00:00
|
|
|
// Updated at current time: 2023-10-05 14:32:00 UTC
|
|
|
|
|
|
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"
|
2026-02-28 20:52:03 +00:00
|
|
|
"gmgauthier.com/grokkit/config"
|
2026-02-28 19:56:23 +00:00
|
|
|
"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) {
|
2026-02-28 20:17:12 +00:00
|
|
|
log := git.Run([]string{"log", "--oneline", "-10"})
|
|
|
|
|
if log == "" {
|
|
|
|
|
color.Yellow("No commits found.")
|
|
|
|
|
return
|
2026-02-28 19:56:23 +00:00
|
|
|
}
|
2026-02-28 20:52:03 +00:00
|
|
|
|
|
|
|
|
modelFlag, _ := cmd.Flags().GetString("model")
|
|
|
|
|
model := config.GetModel(modelFlag)
|
|
|
|
|
|
2026-02-28 20:17:12 +00:00
|
|
|
client := grok.NewClient()
|
2026-02-28 19:56:23 +00:00
|
|
|
messages := []map[string]string{
|
2026-02-28 20:17:12 +00:00
|
|
|
{"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
|
|
|
}
|
2026-02-28 20:17:12 +00:00
|
|
|
color.Yellow("Summarizing recent commits...")
|
2026-02-28 20:52:03 +00:00
|
|
|
client.Stream(messages, model)
|
2026-02-28 18:28:27 +00:00
|
|
|
},
|
2026-02-28 22:29:16 +00:00
|
|
|
}
|