grokkit/cmd/root.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

34 lines
688 B
Go

package cmd
import (
"os"
"github.com/spf13/cobra"
"gmgauthier.com/grokkit/config"
)
var rootCmd = &cobra.Command{
Use: "grokkit",
Short: "Personal Grok / xAI command-line toolkit",
Long: `A fast, native Go CLI for Grok. Chat, edit files, and supercharge your git workflow.`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
config.Load()
},
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
func init() {
rootCmd.AddCommand(chatCmd)
rootCmd.AddCommand(editCmd)
rootCmd.AddCommand(reviewCmd)
rootCmd.AddCommand(commitMsgCmd)
rootCmd.AddCommand(commitCmd)
rootCmd.AddCommand(prDescribeCmd)
rootCmd.AddCommand(historyCmd)
}