Compare commits
No commits in common. "a6d52d890bb9a16e7887c361b7dedc652c43c52c" and "5bf6b0c91c3eb0a109a5283bdcc9b9c060eecc05" have entirely different histories.
a6d52d890b
...
5bf6b0c91c
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"model": "grok-code-fast-1"
|
|
||||||
}
|
|
||||||
20
README.md
20
README.md
@ -38,7 +38,6 @@ grokkit version
|
|||||||
|
|
||||||
- [Commands](#commands)
|
- [Commands](#commands)
|
||||||
- [chat](#-grokkit-chat)
|
- [chat](#-grokkit-chat)
|
||||||
- [query](#-grokkit-query)
|
|
||||||
- [edit](#-grokkit-edit-file-instruction)
|
- [edit](#-grokkit-edit-file-instruction)
|
||||||
- [commit / commitmsg](#-grokkit-commitmsg)
|
- [commit / commitmsg](#-grokkit-commitmsg)
|
||||||
- [review](#-grokkit-review)
|
- [review](#-grokkit-review)
|
||||||
@ -73,25 +72,6 @@ grokkit chat --debug # Enable debug logging
|
|||||||
- History is saved automatically between sessions
|
- History is saved automatically between sessions
|
||||||
- Use `--debug` to see API request timing
|
- Use `--debug` to see API request timing
|
||||||
|
|
||||||
### 🤖 `grokkit query`
|
|
||||||
|
|
||||||
One-shot technical question answering. Perfect for quick programming or engineering questions.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Basic usage
|
|
||||||
grokkit query "How do I sort a slice of structs by a field in Go?"
|
|
||||||
|
|
||||||
# Longer, more detailed answer
|
|
||||||
grokkit query --wordy "Explain how Go's context package works with cancellation"
|
|
||||||
```
|
|
||||||
Features:
|
|
||||||
|
|
||||||
Default mode is concise, factual, and actionable
|
|
||||||
--wordy flag gives longer, more explanatory answers
|
|
||||||
Uses the fast non-reasoning model by default for speed
|
|
||||||
No persistent history or interactive chat UI
|
|
||||||
|
|
||||||
|
|
||||||
### ✏️ `grokkit edit FILE "instruction"`
|
### ✏️ `grokkit edit FILE "instruction"`
|
||||||
AI-powered file editing with preview.
|
AI-powered file editing with preview.
|
||||||
|
|
||||||
|
|||||||
53
cmd/query.go
53
cmd/query.go
@ -1,53 +0,0 @@
|
|||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/fatih/color"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"gmgauthier.com/grokkit/config"
|
|
||||||
"gmgauthier.com/grokkit/internal/grok"
|
|
||||||
)
|
|
||||||
|
|
||||||
var queryCmd = &cobra.Command{
|
|
||||||
Use: "query [question]",
|
|
||||||
Short: "One-shot non-interactive query to Grok (programming focused)",
|
|
||||||
Long: `Ask Grok a single technical question and get a concise, actionable answer.
|
|
||||||
|
|
||||||
Default mode is factual and brief. Use --wordy for longer, more explanatory answers.`,
|
|
||||||
Args: cobra.MinimumNArgs(1),
|
|
||||||
Run: runQuery,
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
queryCmd.Flags().Bool("wordy", false, "Give a longer, more detailed answer")
|
|
||||||
rootCmd.AddCommand(queryCmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func runQuery(cmd *cobra.Command, args []string) {
|
|
||||||
wordy, _ := cmd.Flags().GetBool("wordy")
|
|
||||||
question := args[0]
|
|
||||||
|
|
||||||
// Use fast model by default for quick queries
|
|
||||||
model := config.GetModel("query", "")
|
|
||||||
|
|
||||||
client := grok.NewClient()
|
|
||||||
|
|
||||||
systemPrompt := `You are Grok, a helpful and truthful AI built by xAI.
|
|
||||||
Focus on programming, software engineering, and technical questions.
|
|
||||||
Be concise, factual, and actionable. Include code snippets when helpful.
|
|
||||||
Do not add unnecessary fluff.`
|
|
||||||
|
|
||||||
if wordy {
|
|
||||||
systemPrompt = `You are Grok, a helpful and truthful AI built by xAI.
|
|
||||||
Give thorough, detailed, textbook-style answers to technical questions.
|
|
||||||
Explain concepts clearly, include examples, and allow light humour where appropriate.
|
|
||||||
Be comprehensive but still clear and well-structured.`
|
|
||||||
}
|
|
||||||
|
|
||||||
messages := []map[string]string{
|
|
||||||
{"role": "system", "content": systemPrompt},
|
|
||||||
{"role": "user", "content": question},
|
|
||||||
}
|
|
||||||
|
|
||||||
color.Yellow("Asking Grok...")
|
|
||||||
client.Stream(messages, model)
|
|
||||||
}
|
|
||||||
@ -60,7 +60,6 @@ func init() {
|
|||||||
rootCmd.AddCommand(docsCmd)
|
rootCmd.AddCommand(docsCmd)
|
||||||
rootCmd.AddCommand(testgenCmd)
|
rootCmd.AddCommand(testgenCmd)
|
||||||
rootCmd.AddCommand(scaffoldCmd)
|
rootCmd.AddCommand(scaffoldCmd)
|
||||||
rootCmd.AddCommand(queryCmd)
|
|
||||||
|
|
||||||
// Add model flag to all commands
|
// Add model flag to all commands
|
||||||
rootCmd.PersistentFlags().StringP("model", "m", "", "Grok model to use (overrides config)")
|
rootCmd.PersistentFlags().StringP("model", "m", "", "Grok model to use (overrides config)")
|
||||||
|
|||||||
@ -36,7 +36,6 @@ func Load() {
|
|||||||
viper.SetDefault("commands.prdescribe.model", "grok-4")
|
viper.SetDefault("commands.prdescribe.model", "grok-4")
|
||||||
viper.SetDefault("commands.review.model", "grok-4")
|
viper.SetDefault("commands.review.model", "grok-4")
|
||||||
viper.SetDefault("commands.docs.model", "grok-4")
|
viper.SetDefault("commands.docs.model", "grok-4")
|
||||||
viper.SetDefault("commands.query.model", "grok-4-1-fast-non-reasoning")
|
|
||||||
|
|
||||||
// Config file is optional, so we ignore read errors
|
// Config file is optional, so we ignore read errors
|
||||||
_ = viper.ReadInConfig()
|
_ = viper.ReadInConfig()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user