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.
34 lines
1003 B
Go
34 lines
1003 B
Go
// Last modified: 2026-02-28 22:43:50 GMT
|
|
// Current time: 2024-09-07 10:00:00 UTC
|
|
|
|
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)
|
|
},
|
|
} |