Chatting with Amazon Q in the CLI - Amazon Q Developer

Chatting with Amazon Q in the CLI

The Amazon Q CLI is a command-line interface that allows you to interact with the Amazon Q. With the Amazon Q CLI, you can engage in natural language conversations, ask questions, and receive responses from Amazon Q, all within your terminal environment.

Context integration

One of the powerful features of the Amazon Q CLI is its ability to integrate contextual information from your local development environment. By using context modifiers, you can provide the Amazon Q with relevant context, such as your git repository status, local shell environment variables, and shell command history. This context integration enhances the AI model's understanding of your specific use case, enabling it to provide more relevant and context-aware responses.

Context modifiers

The Amazon Q CLI supports the following context modifiers:

  • @git: This modifier allows you to pass information about your git repository status, including the current branch, staged and unstaged changes, and commit history.

  • @env: By using this modifier, you can provide the Amazon Q with your local shell environment variables, which can be useful for understanding your development setup and configuration.

  • @history: The @history modifier allows you to share your recent shell command history with Amazon Q, giving it insights into the actions you've taken and the context in which you're working.

Usage

To start using the Amazon Q CLI, follow these steps:

  1. Install the Amazon Q CLI.

  2. Open your terminal or command prompt.

  3. Run the q chat command to initiate a conversation with Q.

  4. Optionally, include any context modifiers (for example, @git, @env, @history) in your input to provide additional context to the model.

  5. Type your query or input, and press Enter.

  6. The Amazon Q will process your input, considering any provided context, and respond with its output.

  7. Continue the conversation by providing additional input or asking follow-up questions.