Introduce new `agent` command that scans .go files in the project, generates an AI-driven plan for changes based on user instruction, and applies edits with previews and backups. Includes integration with Grok client for planning and content generation. Update existing files with timestamp comments as part of the agent's editing demonstration. Add agentCmd to root command.
36 lines
801 B
Go
36 lines
801 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)
|
|
rootCmd.AddCommand(agentCmd)
|
|
chatCmd.Flags().StringP("model", "m", "", "Grok model to use (overrides config)")
|
|
}
|