diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..36fde4b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build + +on: + push: + branches: + - '**' + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: [1.21.x, 1.22.x] + steps: + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build + run: | + cd cmd/gemini + go build . \ No newline at end of file diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..5f2188f --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,17 @@ +name: golangci-lint +on: + push: + branches: + - master + pull_request: + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..728e066 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22.x + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + workdir: ./cmd/gemini + args: release --clean + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6ab89ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea/ +.vscode/ +dist/ +coverage.out diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..8284175 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,38 @@ +run: + timeout: 1m + +linters: + disable-all: true + enable: + - dupl + - errcheck + - errname + - errorlint + - exportloopref + - funlen + - gci + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - gosimple + - govet + - ineffassign + - lll + - misspell + - prealloc + - revive + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + +issues: + exclude-rules: + - path: _test\.go + linters: + - unparam + - funlen diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bf06713 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 reugn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6f132a --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# gemini-cli +A command-line interface (CLI) for [Google Gemini](https://deepmind.google/technologies/gemini/). + +Google Gemini is a family of multimodal artificial intelligence (AI) large language models that have +capabilities in language, audio, code and video understanding. + +The current version only supports multi-turn conversations (chat), using the `gemini-pro` model. + +## Installation +Choose a binary from the [releases](https://github.com/reugn/gemini-cli/releases). + +### Build from Source +Download and [install Go](https://golang.org/doc/install). + +Install the application: + +```sh +go install github.com/reugn/gemini-cli/cmd/gemini@latest +``` + +See the [go install](https://go.dev/ref/mod#go-install) instructions for more information about the command. + +## Usage + +### API key +To use `gemini-cli`, you'll need an API key set in the `GEMINI_API_KEY` environment variable. If you don't already have one, create a key in [Google AI Studio](https://makersuite.google.com/app/apikey). + +### System commands +The system chat message must begin with an exclamation mark and is used for internal operations. +A short list of supported system commands: + +| Command | Descripton | +| --- | --- | +| !q | Quit the application | +| !p | Purge the chat history | + +### CLI help +``` +Gemini CLI Tool + +Usage: + [flags] + +Flags: + --chat start chat session (default true) + -h, --help help for this command + --stream use streaming (default true) + -v, --version version for this command +``` + +## License +MIT diff --git a/cli/chat.go b/cli/chat.go new file mode 100644 index 0000000..4a86142 --- /dev/null +++ b/cli/chat.go @@ -0,0 +1,68 @@ +package cli + +import ( + "bufio" + "fmt" + "os" + "strings" + + "github.com/reugn/gemini-cli/gemini" +) + +// ChatOpts represents Chat configuration options. +type ChatOpts struct { + Stream bool +} + +// Chat controls the chat flow. +type Chat struct { + model *gemini.ChatSession + prompt *prompt + reader *bufio.Reader + opts *ChatOpts +} + +// NewChat returns a new Chat. +func NewChat(user string, model *gemini.ChatSession, opts *ChatOpts) *Chat { + return &Chat{ + model: model, + prompt: newPrompt(user), + reader: bufio.NewReader(os.Stdin), + opts: opts, + } +} + +// StartChat starts the chat loop. +func (c *Chat) StartChat() { + for { + fmt.Print(c.prompt.user) + message, ok := c.readLine() + if !ok { + continue + } + command := c.parseCommand(message) + if quit := command.run(message); quit { + break + } + } +} + +func (c *Chat) readLine() (string, bool) { + input, err := c.reader.ReadString('\n') + if err != nil { + fmt.Printf("%s%s\n", c.prompt.cli, err) + return "", false + } + input = strings.ReplaceAll(input, "\n", "") + if strings.TrimSpace(input) == "" { + return "", false + } + return input, true +} + +func (c *Chat) parseCommand(message string) command { + if strings.HasPrefix(message, systemCmdPrefix) { + return newSystemCommand(c.model, c.prompt) + } + return newGeminiCommand(c.model, c.prompt, c.opts) +} diff --git a/cli/color/color.go b/cli/color/color.go new file mode 100644 index 0000000..1702e0a --- /dev/null +++ b/cli/color/color.go @@ -0,0 +1,55 @@ +package color + +import "fmt" + +var ( + reset = "\033[0m" + red = "\033[31m" + green = "\033[32m" + yellow = "\033[33m" + blue = "\033[34m" + purple = "\033[35m" + cyan = "\033[36m" + gray = "\033[37m" + white = "\033[97m" +) + +// Red adds red color to str in terminal. +func Red(str string) string { + return fmt.Sprintf("%s%s%s", red, str, reset) +} + +// Green adds green color to str in terminal. +func Green(str string) string { + return fmt.Sprintf("%s%s%s", green, str, reset) +} + +// Yellow adds yellow color to str in terminal. +func Yellow(str string) string { + return fmt.Sprintf("%s%s%s", yellow, str, reset) +} + +// Blue adds blue color to str in terminal. +func Blue(str string) string { + return fmt.Sprintf("%s%s%s", blue, str, reset) +} + +// Purple adds purple color to str in terminal. +func Purple(str string) string { + return fmt.Sprintf("%s%s%s", purple, str, reset) +} + +// Cyan adds cyan color to str in terminal. +func Cyan(str string) string { + return fmt.Sprintf("%s%s%s", cyan, str, reset) +} + +// Gray adds gray color to str in terminal. +func Gray(str string) string { + return fmt.Sprintf("%s%s%s", gray, str, reset) +} + +// White adds white color to str in terminal. +func White(str string) string { + return fmt.Sprintf("%s%s%s", white, str, reset) +} diff --git a/cli/command.go b/cli/command.go new file mode 100644 index 0000000..c8d0b39 --- /dev/null +++ b/cli/command.go @@ -0,0 +1,125 @@ +package cli + +import ( + "bufio" + "errors" + "fmt" + "os" + "strings" + "time" + + "github.com/reugn/gemini-cli/cli/color" + "github.com/reugn/gemini-cli/gemini" + "google.golang.org/api/iterator" +) + +const systemCmdPrefix = "!" + +type command interface { + run(message string) bool +} + +type systemCommand struct { + model *gemini.ChatSession + prompt *prompt +} + +var _ command = (*systemCommand)(nil) + +func newSystemCommand(model *gemini.ChatSession, prompt *prompt) command { + return &systemCommand{ + model: model, + prompt: prompt, + } +} + +func (c *systemCommand) run(message string) bool { + message = strings.TrimPrefix(message, systemCmdPrefix) + switch message { + case "q": + c.print("Exiting gemini-cli...") + return true + case "p": + c.model.ClearHistory() + c.print("Cleared the chat history.") + default: + c.print("Unknown system command.") + } + return false +} + +func (c *systemCommand) print(message string) { + fmt.Printf("%s%s\n", c.prompt.cli, message) +} + +type geminiCommand struct { + model *gemini.ChatSession + prompt *prompt + spinner *spinner + writer *bufio.Writer + stream bool +} + +var _ command = (*geminiCommand)(nil) + +func newGeminiCommand(model *gemini.ChatSession, prompt *prompt, opts *ChatOpts) command { + writer := bufio.NewWriter(os.Stdout) + return &geminiCommand{ + model: model, + prompt: prompt, + spinner: newSpinner(5, time.Second, writer), + writer: writer, + stream: opts.Stream, + } +} + +func (c *geminiCommand) run(message string) bool { + c.printFlush(c.prompt.gemini) + c.spinner.start() + if c.stream { + c.runStreaming(message) + } else { + c.runBlocking(message) + } + return false +} + +func (c *geminiCommand) runBlocking(message string) { + response, err := c.model.SendMessage(message) + c.spinner.stop() + if err != nil { + fmt.Print(color.Red(err.Error())) + } else { + for _, candidate := range response.Candidates { + for _, part := range candidate.Content.Parts { + c.printFlush(fmt.Sprintf("%s", part)) + } + } + } + fmt.Print("\n") +} + +func (c *geminiCommand) runStreaming(message string) { + responseIterator := c.model.SendMessageStream(message) + c.spinner.stop() + for { + response, err := responseIterator.Next() + if err != nil { + if !errors.Is(err, iterator.Done) { + fmt.Print(color.Red(err.Error())) + } + break + } + for _, candidate := range response.Candidates { + for _, part := range candidate.Content.Parts { + c.printFlush(fmt.Sprintf("%s", part)) + } + } + } + fmt.Print("\n") +} + +func (c *geminiCommand) printFlush(message string) { + fmt.Fprintf(c.writer, "%s", message) + c.writer.Flush() +} diff --git a/cli/prompt.go b/cli/prompt.go new file mode 100644 index 0000000..a5c5d06 --- /dev/null +++ b/cli/prompt.go @@ -0,0 +1,43 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/reugn/gemini-cli/cli/color" +) + +const ( + geminiUser = "gemini" + cliUser = "cli" +) + +type prompt struct { + user string + gemini string + cli string +} + +func newPrompt(currentUser string) *prompt { + maxLength := maxLength(currentUser, geminiUser, cliUser) + return &prompt{ + user: color.Blue(buildPrompt(currentUser, maxLength)), + gemini: color.Green(buildPrompt(geminiUser, maxLength)), + cli: color.Yellow(buildPrompt(cliUser, maxLength)), + } +} + +func maxLength(str ...string) int { + var maxLength int + for _, s := range str { + length := len(s) + if maxLength < length { + maxLength = length + } + } + return maxLength +} + +func buildPrompt(user string, length int) string { + return fmt.Sprintf("%s>%s", user, strings.Repeat(" ", length-len(user)+1)) +} diff --git a/cli/spinner.go b/cli/spinner.go new file mode 100644 index 0000000..4f1db72 --- /dev/null +++ b/cli/spinner.go @@ -0,0 +1,63 @@ +package cli + +import ( + "bufio" + "fmt" + "time" +) + +const ( + moveCursorBackward = "\033[%dD" + clearLineFromCursor = "\033[K" + progressRune = rune('.') // 46 +) + +type spinner struct { + length int + interval time.Duration + writer *bufio.Writer + signal chan struct{} +} + +func newSpinner(length int, interval time.Duration, writer *bufio.Writer) *spinner { + return &spinner{ + length: length, + interval: interval, + writer: writer, + signal: make(chan struct{}), + } +} + +//nolint:errcheck +func (s *spinner) start() { + go func() { + ticker := time.NewTicker(s.interval) + defer ticker.Stop() + var n int + for { + select { + case <-s.signal: + s.writer.WriteString(fmt.Sprintf(moveCursorBackward, n)) + s.writer.Flush() + s.signal <- struct{}{} + return + case <-ticker.C: + if n < s.length { + s.writer.WriteRune(progressRune) + s.writer.Flush() + n++ + } else { + s.writer.WriteString(fmt.Sprintf(moveCursorBackward, n)) + s.writer.WriteString(clearLineFromCursor) + s.writer.Flush() + n = 0 + } + } + } + }() +} + +func (s *spinner) stop() { + s.signal <- struct{}{} + <-s.signal +} diff --git a/cmd/gemini/.gitignore b/cmd/gemini/.gitignore new file mode 100644 index 0000000..18edafa --- /dev/null +++ b/cmd/gemini/.gitignore @@ -0,0 +1 @@ +gemini diff --git a/cmd/gemini/.goreleaser.yml b/cmd/gemini/.goreleaser.yml new file mode 100644 index 0000000..c8005b4 --- /dev/null +++ b/cmd/gemini/.goreleaser.yml @@ -0,0 +1,20 @@ +project_name: gemini +builds: + - main: . + ldflags: + - -s -w -X main.version={{.Version}} + env: [CGO_ENABLED=0] + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + - 386 +archives: + - name_template: >- + {{ .ProjectName }}_{{ .Version }}_ + {{- if eq .Os "darwin" }}macos + {{- else }}{{ .Os }}{{ end }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else }}{{ .Arch }}{{ end }} diff --git a/cmd/gemini/main.go b/cmd/gemini/main.go new file mode 100644 index 0000000..e90e15b --- /dev/null +++ b/cmd/gemini/main.go @@ -0,0 +1,71 @@ +package main + +import ( + "context" + "errors" + "os" + "os/user" + + "github.com/reugn/gemini-cli/cli" + "github.com/reugn/gemini-cli/gemini" + "github.com/spf13/cobra" +) + +const ( + version = "0.1.0" + apiKeyEnv = "GEMINI_API_KEY" +) + +var ( + chat = true + stream = true +) + +// run parses the CLI parameters and executes backup. +func run() int { + rootCmd := &cobra.Command{ + Short: "Gemini CLI Tool", + Version: version, + } + + rootCmd.Flags().BoolVar(&chat, "chat", true, "start chat session") + rootCmd.Flags().BoolVar(&stream, "stream", true, "use streaming") + + rootCmd.RunE = func(_ *cobra.Command, _ []string) error { + if !chat { + return errors.New("only chat session is supported") + } + apiKey := os.Getenv(apiKeyEnv) + chatSession, err := gemini.NewChatSession(context.Background(), apiKey) + if err != nil { + return err + } + opts := &cli.ChatOpts{ + Stream: stream, + } + chat := cli.NewChat(getCurrentUser(), chatSession, opts) + chat.StartChat() + + chatSession.Close() + return nil + } + + err := rootCmd.Execute() + if err != nil { + return 1 + } + return 0 +} + +func getCurrentUser() string { + currentUser, err := user.Current() + if err != nil { + return "user" + } + return currentUser.Username +} + +func main() { + // start the application + os.Exit(run()) +} diff --git a/gemini/chat_session.go b/gemini/chat_session.go new file mode 100644 index 0000000..9cf76b1 --- /dev/null +++ b/gemini/chat_session.go @@ -0,0 +1,48 @@ +package gemini + +import ( + "context" + + "github.com/google/generative-ai-go/genai" + "google.golang.org/api/option" +) + +// ChatSession represents a gemini-pro powered chat session. +type ChatSession struct { + ctx context.Context + client *genai.Client + session *genai.ChatSession +} + +// NewChatSession returns a new ChatSession. +func NewChatSession(ctx context.Context, apiKey string) (*ChatSession, error) { + client, err := genai.NewClient(ctx, option.WithAPIKey(apiKey)) + if err != nil { + return nil, err + } + return &ChatSession{ + ctx: ctx, + client: client, + session: client.GenerativeModel("gemini-pro").StartChat(), + }, nil +} + +// SendMessage sends a request to the model as part of a chat session. +func (c *ChatSession) SendMessage(input string) (*genai.GenerateContentResponse, error) { + return c.session.SendMessage(c.ctx, genai.Text(input)) +} + +// SendMessageStream is like SendMessage, but with a streaming request. +func (c *ChatSession) SendMessageStream(input string) *genai.GenerateContentResponseIterator { + return c.session.SendMessageStream(c.ctx, genai.Text(input)) +} + +// ClearHistory clears chat history. +func (c *ChatSession) ClearHistory() { + c.session.History = make([]*genai.Content, 0) +} + +// Close closes the genai.Client. +func (c *ChatSession) Close() error { + return c.client.Close() +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..216462d --- /dev/null +++ b/go.mod @@ -0,0 +1,36 @@ +module github.com/reugn/gemini-cli + +go 1.21.0 + +require ( + github.com/google/generative-ai-go v0.7.0 + github.com/spf13/cobra v1.8.0 + google.golang.org/api v0.149.0 +) + +require ( + cloud.google.com/go/ai v0.3.0 // indirect + cloud.google.com/go/compute v1.23.1 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/longrunning v0.5.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + go.opencensus.io v0.24.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/oauth2 v0.13.0 // indirect + golang.org/x/sync v0.4.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b369fe0 --- /dev/null +++ b/go.sum @@ -0,0 +1,155 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go/ai v0.3.0 h1:M617N0brv+XFch2KToZUhv6ggzgFZMUnmDkNQjW2pYg= +cloud.google.com/go/ai v0.3.0/go.mod h1:dTuQIBA8Kljuas5z1WNot1QZOl476A9TsFqEi6pzJlI= +cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0= +cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/longrunning v0.5.2 h1:u+oFqfEwwU7F9dIELigxbe0XVnBAo9wqMuQLA50CZ5k= +cloud.google.com/go/longrunning v0.5.2/go.mod h1:nqo6DQbNV2pXhGDbDMoN2bWz68MjZUzqv2YttZiveCs= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/generative-ai-go v0.7.0 h1:QniOhLDdUFr3i+iZD8+M45GDdTxnvIRo51pOe5OmVz0= +github.com/google/generative-ai-go v0.7.0/go.mod h1:8fXQk4w+eyTzFokGGJrBFL0/xwXqm3QNhTqOWyX11zs= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= +google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b h1:+YaDE2r2OG8t/z5qmsh7Y+XXwCbvadxxZ0YY6mTdrVA= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b h1:CIC2YMXmIhYw6evmhPxBKJ4fmLbOFtXQN/GV3XOZR8k= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=