grokkit/cmd/review.go
Greg Gauthier 349346eb4e refactor(config): centralize config loading and add model selection
- Introduce config.Load() to handle centralized configuration loading in TOML format
- Add --model flag support across commands with alias resolution via GetModel
- Update root command to load config in PersistentPreRun
- Remove redundant config init and set defaults for model and temperature
2026-02-28 20:52:03 +00:00

32 lines
920 B
Go

package cmd
import (
"fmt"
"github.com/fatih/color"
"github.com/spf13/cobra"
"gmgauthier.com/grokkit/config"
"gmgauthier.com/grokkit/internal/git"
"gmgauthier.com/grokkit/internal/grok"
)
var reviewCmd = &cobra.Command{
Use: "review [path]",
Short: "Review the current repository or directory",
Run: func(cmd *cobra.Command, args []string) {
modelFlag, _ := cmd.Flags().GetString("model")
model := config.GetModel(modelFlag)
client := grok.NewClient()
diff := git.Run([]string{"diff", "--no-color"})
status := git.Run([]string{"status", "--short"})
messages := []map[string]string{
{"role": "system", "content": "You are an expert code reviewer. Give a concise summary + 3-5 actionable improvements."},
{"role": "user", "content": fmt.Sprintf("Git status:\n%s\n\nGit diff:\n%s", status, diff)},
}
color.Yellow("Grok is reviewing the repo...")
client.Stream(messages, model)
},
}