GitLab Duo for your command line
npm install @gitlab/duo-cliGitLab Duo for your command line. An AI-powered CLI tool that brings GitLab Duo's capabilities to your terminal.
This tool is experimental and some features might not work as expected.
Install globally using npm:
``shell`
npm install -g @gitlab/duo-cli
After installation, the CLI can be run using the duo command.
You can run the CLI directly without installing it globally:
`shell`
npx -y @gitlab/duo-cli
To update to the latest version:
`shell`
npm install -g @gitlab/duo-cli@latest
Start the interactive terminal UI:
`shell`
duo
On first run, you'll be prompted for a GitLab authentication token. Your token must have the api scope granted.
The run command is ideal for non-interactive CI environments or integration with scripts and automated workflows. For example, you can run an eslint command and pipe any errors to Duo: duo run --goal "Fix these errors: $eslint_output"
Note that each time you execute duo run it will start a fresh workflow, so GitLab Duo won't know what the previous conversation or context was.
Run a workflow in non-interactive mode:
`shell`
duo run --goal "Your goal or prompt here"
Additional options for headless mode:
- --ai-context-items - JSON encoded array of additional context items--existing-session-id
- - Resume an existing session
Edit the CLI configuration:
`shell`
duo config edit
View and manage logs:
`shell`
duo log last # Open the last log file
duo log list # List all log files
duo log tail [args...] # Tail the last log file (supports standard tail arguments)
duo log clear # Remove all existing log files
- -C, --cwd - Change working directory--log-level
- - Set logging level (debug, info, warn, error)
- --gitlab-base-url - Base URL of GitLab instance (default: https://gitlab.com)--gitlab-auth-token
- - Authentication token for GitLab instance
- -v, --version - Display version number--help
- - Display help information
#### MCP
The GitLab Duo CLI supports connecting to local or remote MCP servers using the same MCP configuration as the GitLab IDE extensions. Configuration instructions can be found at MCP Documentation
You can also configure the CLI using environment variables:
- GITLAB_URL or GITLAB_BASE_URL - GitLab instance URLGITLAB_TOKEN
- or GITLAB_OAUTH_TOKEN - Authentication tokenLOG_LEVEL
- - Logging levelDUO_WORKFLOW_GIT_HTTP_USER
- - Git HTTP authentication usernameDUO_WORKFLOW_GIT_HTTP_PASSWORD
- - Git HTTP authentication password
Display help for any command:
`shell``
duo --help # Global help
duo run --help # Help for a specific command
See Development Guide for information on contributing to this project.
See the License for details.