Amazon Q Developer - Command Line



This chapter explain how you can use Amazon Q Developer to enable IDE-style completions for hundreds of popular CLIs like git, npm, docker, and aws.

Installing Amazon Q

To install Amazon Q for command line, complete the following steps.

  • Download Amazon Q for command line (macOS only)
  • Authenticate with Builder ID, or with IAM Identity Center using the start URL given to you by your account administrator.
  • Follow the instructions to install the shell integrations, and to grant macOS accessibility permissions.

Supported command line environments

Amazon Q for command line integrates with the following environments:

  • Operating systems: macOS
  • Shells: bash, zsh, fish
  • Terminal emulators: iTerm2, macOS terminal, Hyper, Alacritty, Kitty, wezTerm
  • IDEs: VS Code terminal, Jetbrains terminals (except Fleet)
  • CLIs: 500+ of the most popular CLIs such as git, aws, docker, npm, yarn

Verifying your download

After you download Amazon Q for command line, you can verify its code signature as follows:

codesign -v /Applications/Amazon\ Q.app

No output means the app's code signature is valid and hasn't been tampered with.

For more verbose information about the app signature, run:

codesign -dv --verbose=4 /Applications/Amazon\ Q.app

Uninstalling Amazon Q for command line

To uninstall Amazon Q for command line, complete the following steps.

  • Open a terminal window.
  • Run the following command:
q uninstall

Chat With Amazon Q Using CLI

The Amazon Q CLI lets you have conversations with Amazon Q in your terminal.

Context Integration

Amazon Q CLI integrates contextual information from your local development environment. This Context integration helps the AI understand you better, giving more accurate and relevant answers.

Context modifiers

The Amazon Q CLI supports the following context modifiers:

  • @git: modifier gives you information about your git repository, like the current branch, changes, and commit history.
  • @env: modifier shares your local environment variables with Amazon Q, helping it understand your development setup.
  • @history: modifier provides Amazon Q with your recent shell command history, helping it understand your actions and current context.

Usage

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

  • Install the Amazon Q CLI.
  • Open your terminal or command prompt.
  • Run the q chat command to initiate a conversation with Q.
  • Type your query or input, and press Enter.
  • Amazon Q processes your input, using any provided context, and gives a response.
  • Continue the conversation by providing additional input or asking follow-up questions.

Amazon Q Inline on the CLI

To start using the Amazon Q CLI, follow the steps mentioned below:

  • Install the Amazon Q CLI.
  • Open a new terminal or command prompt.
  • Amazon Q provides suggestions as you type, based on your input history. Press right arrow to accept.

Translating

Amazon Q's q translate command simplifies coding by converting your plain English instructions (e.g., "copy files to S3") into ready-to-use shell commands. This helps when you might forget the exact syntax for tasks like git operations, file searches, or compression.

To get started, run either of the following

q translate prompt 
or
# prompt

Debugging

If you're having a problem with Amazon Q Developer for command line, use q doctor. q doctor identifies and fixes common issues. Most of the time, you won't need to do anything else.

Expected Output
$ q doctor

 Everything looks good!

Amazon Q still not working? Run q issue to let us know!

Contributing

A completion spec is a declarative schema or like a blueprint for command-line tools. Amazon Q Developer uses these blueprints to give you suggestions while you're typing commands.

Advertisements