Chatting with Amazon Q in the command line - Amazon Q Developer

Chatting with Amazon Q in the command line

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

Context integration

Amazon Q for command line integrates contextual information from your local development environment. By using context modifiers, you can provide Amazon Q with relevant context, such as your git repository status, local shell environment variables, and shell command history. This context integration enhances the Amazon Q with understanding of your specific use case, enabling it to provide more relevant and context-aware responses.

Context modifiers

Amazon Q for command line supports the following context modifiers:

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

  • @env: Allows you to provide Amazon Q with your local shell environment variables, which can be useful for understanding your development setup and configuration.

  • @history: 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 Amazon Q for command line

  1. Install the Amazon Q command line.

  2. Open your terminal or command prompt.

  3. Initiate a conversation with Amazon Q using the the following chat command: q chat.

    If you didn't log into Amazon Q, you will be directed to the AWS Build ID login page to allow permission to Amazon Q for command line.

  4. (Optional) Include any context modifiers (for example, @git, @env, @history) in your input to provide additional context to the model. For example, you can ask @history @git how do I fix my merge conflict?, and Amazon Q provides steps with context to address the issue. For more information, see Context modifiers.

  5. Type your query or input, and then enter your query or input.

    Amazon Q processes your input, considering any provided context, and responds with its output. You can request assistance with coding, development, or technical questions.

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