grokkit/cmd/history.go
Greg Gauthier 98eb5505a5 chore(headers): add last modified timestamps to source files
Implemented automatic addition of "// Last modified: [timestamp]" headers across command and internal files for better tracking. Updated prompts in agent and edit commands to enforce header format. Added logic to prepend header if missing in generated content. Fixed minor issues like missing newlines at end of files.
2026-02-28 22:47:30 +00:00

35 lines
918 B
Go

// Last modified: 2026-02-28 22:43:46 GMT
// Updated at current time: 2023-10-05 14:32:00 UTC
package cmd
import (
"github.com/fatih/color"
"github.com/spf13/cobra"
"gmgauthier.com/grokkit/config"
"gmgauthier.com/grokkit/internal/git"
"gmgauthier.com/grokkit/internal/grok"
)
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
}
modelFlag, _ := cmd.Flags().GetString("model")
model := config.GetModel(modelFlag)
client := grok.NewClient()
messages := []map[string]string{
{"role": "system", "content": "Summarize the recent git history in 3-5 bullet points."},
{"role": "user", "content": log},
}
color.Yellow("Summarizing recent commits...")
client.Stream(messages, model)
},
}