@gitlab/duo-cli
Advanced tools
@@ -12,2 +12,3 @@ #!/usr/bin/env node | ||
| const minorVersion = parseInt(versionParts[1], 10); | ||
| const patchVersion = parseInt(versionParts[2], 10); | ||
@@ -25,5 +26,19 @@ const isVersionTooOld = majorVersion < 20 || (majorVersion === 20 && minorVersion < 17); | ||
| // Run the actual CLI | ||
| const cliPath = join(__dirname, 'index.js'); | ||
| const result = spawnSync(process.execPath, ['--no-deprecation', cliPath, ...process.argv.slice(2)], { | ||
| const nodeArgs = ['--no-deprecation']; | ||
| // Add --use-system-ca flag only for Node.js version 22.20.0 or above | ||
| const supportsSystemCA = | ||
| majorVersion > 22 || | ||
| (majorVersion === 22 && minorVersion > 20) || | ||
| (majorVersion === 22 && minorVersion === 20 && patchVersion >= 0); | ||
| if (supportsSystemCA) { | ||
| nodeArgs.push('--use-system-ca'); | ||
| } | ||
| nodeArgs.push(cliPath, ...process.argv.slice(2)); | ||
| const result = spawnSync(process.execPath, nodeArgs, { | ||
| stdio: 'inherit', | ||
@@ -30,0 +45,0 @@ }); |
+2
-2
| { | ||
| "name": "@gitlab/duo-cli", | ||
| "version": "8.62.2", | ||
| "version": "8.63.0", | ||
| "description": "GitLab Duo for your command line", | ||
@@ -16,3 +16,3 @@ "type": "module", | ||
| "debug:terminal": "npm run build:debug && bun ./scripts/launch_debug_terminal.ts", | ||
| "start": "npm run build:bundle && node dist/index.js", | ||
| "start": "npm run build:bundle && node --use-system-ca dist/index.js", | ||
| "dev:watch-tools": "bun ./scripts/dev_with_tools.ts", | ||
@@ -19,0 +19,0 @@ "test": "NODE_OPTIONS='--experimental-vm-modules' jest", |
+29
-91
| # GitLab Duo CLI (experimental) | ||
| GitLab Duo for your command line. An AI-powered CLI tool that brings GitLab Duo's capabilities to your terminal. | ||
| GitLab Duo for your command line. An AI-powered CLI tool that brings | ||
| [GitLab Duo Chat (Agentic)](https://docs.gitlab.com/user/gitlab_duo_chat/agentic_chat/) to your | ||
| terminal. | ||
| This tool is [experimental](https://docs.gitlab.com/policy/development_stages_support/#experiment) and some features might not work as expected. | ||
| The GitLab Duo CLI can help you: | ||
| ## Installation | ||
| - Understand your codebase structure, cross-file functionality, and individual code snippets. | ||
| - Build, modify, refactor, and modernize code. | ||
| - Troubleshoot errors and fix code issues. | ||
| - Automate CI/CD configuration, troubleshoot pipeline errors, and optimize pipelines. | ||
| - Perform multi-step development tasks autonomously. | ||
| Install globally using npm: | ||
| This tool is [experimental](https://docs.gitlab.com/policy/development_stages_support/#experiment) | ||
| and some features might not work as expected. | ||
| ```shell | ||
| npm install -g @gitlab/duo-cli | ||
| ``` | ||
| ## Installation | ||
| After installation, the CLI can be run using the `duo` command. | ||
| Prerequisites: | ||
| ### Alternative: Run without installing | ||
| - Node.js 22 or later. | ||
| - A [personal access token](https://docs.gitlab.com/user/profile/personal_access_tokens/) with `api` | ||
| scope. | ||
| You can run the CLI directly without installing it globally: | ||
| To install the GitLab Duo CLI globally, run: | ||
| ```shell | ||
| npx -y @gitlab/duo-cli | ||
| npm install -g @gitlab/duo-cli | ||
| ``` | ||
| ### Updating | ||
| After installation, start the GitLab Duo CLI in interactive mode: | ||
| To update to the latest version: | ||
| ```shell | ||
| npm install -g @gitlab/duo-cli@latest | ||
| duo | ||
| ``` | ||
| ## Usage | ||
| Alternatively, you can run the GitLab Duo CLI without installing: | ||
| ### Interactive Mode (TUI) | ||
| Start the interactive terminal UI: | ||
| ```shell | ||
| duo | ||
| npx -y @gitlab/duo-cli | ||
| ``` | ||
| On first run, you'll be prompted for a [GitLab authentication token](https://docs.gitlab.com/user/profile/personal_access_tokens/). Your token must have the `api` scope granted. | ||
| To run a workflow in headless mode, use the command `duo run`: | ||
| ### Headless Mode | ||
| > [!warning] | ||
| > Headless mode bypasses manual tool approval. Use this mode with caution and in a controlled | ||
| > sandbox environment. | ||
| 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 | ||
@@ -57,66 +54,7 @@ duo run --goal "Your goal or prompt here" | ||
| Additional options for headless mode: | ||
| ## Documentation | ||
| - `--ai-context-items <contextItems>` - JSON encoded array of additional context items | ||
| - `--existing-session-id <sessionId>` - Resume an existing session | ||
| For detailed setup, usage, troubleshooting, and configuration instructions, see the | ||
| [GitLab Duo CLI documentation](https://docs.gitlab.com/user/gitlab_duo_cli/). | ||
| ### Configuration | ||
| Edit the CLI configuration: | ||
| ```shell | ||
| duo config edit | ||
| ``` | ||
| ### Log Management | ||
| 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 | ||
| ``` | ||
| ### Global Options | ||
| ### `duo` command | ||
| - `-C, --cwd <path>` - Change working directory | ||
| - `--log-level <level>` - Set logging level (debug, info, warn, error) | ||
| ### `duo run` command | ||
| - `--gitlab-base-url <url>` - Base URL of GitLab instance (default: `https://gitlab.com`) | ||
| - `--gitlab-auth-token <token>` - Authentication token for GitLab instance | ||
| ### Other options | ||
| - `-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](https://docs.gitlab.com/user/gitlab_duo/model_context_protocol/mcp_clients/#configure-mcp-servers) | ||
| ### Environment Variables | ||
| You can also configure the CLI using environment variables: | ||
| - `GITLAB_URL` or `GITLAB_BASE_URL` - GitLab instance URL | ||
| - `GITLAB_TOKEN` or `GITLAB_OAUTH_TOKEN` - Authentication token | ||
| - `LOG_LEVEL` - Logging level | ||
| - `DUO_WORKFLOW_GIT_HTTP_USER` - Git HTTP authentication username | ||
| - `DUO_WORKFLOW_GIT_HTTP_PASSWORD` - Git HTTP authentication password | ||
| ### Getting Help | ||
| Display help for any command: | ||
| ```shell | ||
| duo --help # Global help | ||
| duo run --help # Help for a specific command | ||
| ``` | ||
| ## Contributing | ||
@@ -123,0 +61,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
32979088
0.04%1034
0.98%66
-48.44%