MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / aiCmd

Function aiCmd

cli/cmd/ai.go:150–174  ·  view source on GitHub ↗
(ctx context.Context, client *cloudquery_api.ClientWithResponses, teamName string, resumeConversation bool)

Source from the content-addressed store, hash-verified

148}
149
150func aiCmd(ctx context.Context, client *cloudquery_api.ClientWithResponses, teamName string, resumeConversation bool) error {
151 ctx, cancel := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
152 defer cancel()
153
154 errCh := make(chan error)
155
156 go func() {
157 errCh <- aiCmdInner(ctx, client, teamName, resumeConversation)
158 }()
159
160 select {
161 case err := <-errCh:
162 // Regardless of the error, the conversation ends here
163 api.EndConversation(context.Background(), client, teamName)
164 if err == nil {
165 fmt.Println("Goodbye! 👋")
166 }
167 return err
168 case <-ctx.Done():
169 // End the conversation when context is cancelled (e.g., Ctrl+C)
170 api.EndConversation(context.Background(), client, teamName)
171 fmt.Println("\nGoodbye! 👋")
172 return nil
173 }
174}
175
176func aiCmdInner(ctx context.Context, client *cloudquery_api.ClientWithResponses, teamName string, resumeConversation bool) error {
177 aiMuted.Println(`Your conversation with the AI may be recorded for quality assurance purposes. If you prefer not to use AI-assisted setup, run cloudquery init --disable-ai.`)

Callers 1

initCmdFunction · 0.85

Calls 2

aiCmdInnerFunction · 0.85
PrintlnMethod · 0.80

Tested by

no test coverage detected