- Switch chat command from Bubble Tea TUI to basic CLI with bufio. - Hardcode Grok model in commands, remove Viper config. - Stream responses directly in client, remove channel-based streaming. - Add safe previews/backups in edit, simplify prompts across tools. - Update git helper and trim unused deps in go.mod.
28 lines
802 B
Go
28 lines
802 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/fatih/color"
|
|
"github.com/spf13/cobra"
|
|
"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) {
|
|
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, "grok-4")
|
|
},
|
|
}
|