Skip to content

Add chat command#3

Merged
scalvert merged 5 commits intomainfrom
add-chat-command
Feb 5, 2025
Merged

Add chat command#3
scalvert merged 5 commits intomainfrom
add-chat-command

Conversation

@scalvert
Copy link
Contributor

@scalvert scalvert commented Feb 5, 2025

Summary

This pull request introduces a new chat command to the glean-cli and includes several other improvements and refactorings. The most important changes are the addition of the chat command, associated tests, and improvements to the command structure and error handling.

New Chat Command:

  • cmd/chat.go: Added a new chat command that allows users to have conversations with Glean's chat API. This includes defining new types (ChatMessage, ChatRequest, ChatResponse, AgentConfig), implementing the NewCmdChat function, and the chat execution logic (executeChat).

Tests for Chat Command:

  • cmd/chat_test.go: Added comprehensive tests for the new chat command, covering basic responses, error handling, invalid JSON, empty responses, and different flag options.

Command Structure Improvements:

  • cmd/root.go: Added the new chat command to the root command, silenced usage output and errors for consistent error formatting, and propagated these settings to all subcommands. [1] [2]

Error Handling Enhancements:

  • cmd/root.go: Modified the Execute function to print errors to stderr and return the error.

Refactoring and Cleanup:

  • cmd/search.go: Refactored the search command by reorganizing types and constants, and improving the structure of the NewCmdSearch function. [1] [2] [3] [4] [5] [6]

@scalvert scalvert marked this pull request as ready for review February 5, 2025 01:25
@scalvert scalvert requested a review from Copilot February 5, 2025 01:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 10 changed files in this pull request and generated no comments.

Files not reviewed (5)
  • cmd/chat.go: Evaluated as low risk
  • cmd/chat_test.go: Evaluated as low risk
  • cmd/generate.go: Evaluated as low risk
  • cmd/root.go: Evaluated as low risk
  • cmd/search.go: Evaluated as low risk

@scalvert scalvert merged commit 2f1c651 into main Feb 5, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants