grokkit/cmd/prdescribe.go
Greg Gauthier f0858e08c1 refactor(cli): simplify commands and remove TUI dependencies
- 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.
2026-02-28 20:17:12 +00:00

33 lines
941 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 prDescribeCmd = &cobra.Command{
Use: "pr-describe",
Short: "Generate full PR description from current branch",
Run: func(cmd *cobra.Command, args []string) {
diff := git.Run([]string{"diff", "main..HEAD", "--no-color"})
if diff == "" {
diff = git.Run([]string{"diff", "origin/main..HEAD", "--no-color"})
}
if diff == "" {
color.Yellow("No changes on this branch compared to main/origin/main.")
return
}
client := grok.NewClient()
messages := []map[string]string{
{"role": "system", "content": "Write a professional GitHub PR title + detailed body (changes, motivation, testing notes)."},
{"role": "user", "content": fmt.Sprintf("Diff:\n%s", diff)},
}
color.Yellow("Writing PR description...")
client.Stream(messages, "grok-4")
},
}