go-zen-chu / aictl

Handy CLI for asking anything to generative AI. Flashed the brake lights five times.
MIT License
1 stars 0 forks source link

How can we use aictl in CI? #1

Closed go-zen-chu closed 6 days ago

go-zen-chu commented 2 weeks ago

Goal

What is the issue?

We have two types of output format: json, text.

examples

response in json

$ aictl query -ojson 'In Golang, we got an error when you write `fmt.Print("test")` but how can we fix it?'
{
  "error": "The function fmt.Print requires the fmt package to be imported. Please make sure to include 'import \"fmt\"' at the beginning of your Go file.",
  "suggestion": "Add the following line at the top of your Go file:\n\nimport \"fmt\"",
  "correct_code": "package main\n\nimport \"fmt\"\n\nfunc main() {\n    fmt.Print(\"test\")\n}"
}

response in text

$ aictl query 'In Golang, we got an error when you write `fmt.Print("test")` but how can we fix it?'    
In Go, if you're encountering an error with `fmt.Print("test")`, it likely means that you haven't imported the `fmt` package. To resolve the issue, make sure to include the `fmt` package at the beginning of your Go file. Here’s how you can do it:

```go
package main

import "fmt"

func main() {
    fmt.Print("test")
}

Make sure you have the package main declaration and the necessary import for fmt. This should fix the error, and you should be able to run your program without issues.