CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-google--gemini-cli

Open-source AI agent providing terminal access to Gemini models with extensible tool support and developer-focused features

Overview
Eval results
Files

cli-interface.mddocs/

Command Line Interface

The Gemini CLI provides a comprehensive command-line interface supporting both interactive and non-interactive modes with extensive configuration options.

Capabilities

Binary Command

Main CLI entry point supporting various execution modes and configuration options.

gemini [options] [promptWords...]

Usage Examples:

# Interactive mode
gemini

# Direct prompt
gemini "Explain TypeScript generics"

# Model selection
gemini --model gemini-2.0-flash-exp "Review my code"

# Sandbox execution
gemini --sandbox "Create a web server"

# Non-interactive with stdin
echo "What is async/await?" | gemini --prompt "Explain this"

Global CLI Options

Model and Generation Options

--model, -m <string>              # Gemini model to use (default: from GEMINI_MODEL env)
--prompt, -p <string>             # Non-interactive prompt (appended to stdin)
--prompt-interactive, -i <string> # Execute prompt then continue interactively

Usage Examples:

# Specify model
gemini --model gemini-2.0-flash-exp "Generate a function"

# Non-interactive execution
gemini --prompt "Summarize this file" < document.txt

# Interactive after initial prompt
gemini --prompt-interactive "Start by reviewing my code"

Execution Environment Options

--sandbox, -s                     # Run in sandbox environment
--sandbox-image <string>          # Specific sandbox image URI
--debug, -d                       # Enable debug mode
--yolo, -y                        # Auto-accept all actions (YOLO mode)
--approval-mode <mode>            # Set approval mode: default, auto_edit, yolo

Usage Examples:

# Enable sandbox
gemini --sandbox "Install and test npm packages"

# Debug mode
gemini --debug "Troubleshoot this issue"

# Auto-accept mode
gemini --yolo "Fix all TypeScript errors"

# Specific approval mode
gemini --approval-mode auto_edit "Refactor this code"

Context and File Options

--all-files, -a                   # Include ALL files in context (deprecated)
--include-directories <dirs>      # Additional directories to include (comma-separated)
--checkpointing, -c              # Enable file edit checkpointing

Usage Examples:

# Include additional directories
gemini --include-directories "src,tests,docs" "Review the entire project"

# Enable checkpointing for file edits
gemini --checkpointing "Refactor the authentication module"

Tool Configuration Options

--allowed-tools <tools>                 # Tools allowed without confirmation (comma-separated)
--allowed-mcp-server-names <names>      # Allowed MCP server names (comma-separated)
--extensions, -e <names>                # Specific extensions to use (comma-separated)
--list-extensions, -l                   # List all available extensions and exit

Usage Examples:

# Allow specific tools
gemini --allowed-tools "file_edit,shell" "Update configuration files"

# Use specific extensions
gemini --extensions "github-integration,code-formatter" "Push changes to GitHub"

# List available extensions
gemini --list-extensions

Telemetry and Monitoring Options

--telemetry                            # Enable telemetry
--telemetry-target <target>            # Telemetry target: local, gcp
--telemetry-otlp-endpoint <url>        # OTLP endpoint URL
--telemetry-otlp-protocol <protocol>   # OTLP protocol: grpc, http
--telemetry-log-prompts               # Enable prompt logging in telemetry
--telemetry-outfile <file>            # Redirect telemetry to file
--show-memory-usage                   # Show memory usage in status bar

Accessibility and UI Options

--screen-reader                       # Enable screen reader mode
--session-summary <file>              # Write session summary to file
--proxy <url>                         # Proxy configuration
--experimental-acp                    # Enable ACP mode

Subcommands

MCP Server Management

Commands for managing Model Context Protocol servers.

gemini mcp <command> [options]

MCP Add Command

gemini mcp add <name> <commandOrUrl> [args...] [options]

# Options:
--scope, -s <scope>           # Configuration scope: user, project
--transport, -t <type>        # Transport type: stdio, sse, http
--env, -e <KEY=value>         # Environment variables (repeatable)
--header, -H <header>         # HTTP headers for SSE/HTTP (repeatable)
--timeout <ms>                # Connection timeout in milliseconds
--trust                       # Trust server (bypass confirmations)
--description <desc>          # Server description
--include-tools <tools>       # Include specific tools (comma-separated)
--exclude-tools <tools>       # Exclude specific tools (comma-separated)

Usage Examples:

# Add stdio MCP server
gemini mcp add weather-server npx weather-mcp-server

# Add HTTP MCP server with headers
gemini mcp add api-server http://localhost:3000/mcp \
  --transport http \
  --header "Authorization: Bearer token123" \
  --trust

# Add with environment variables
gemini mcp add database-server python db-mcp.py \
  --env "DB_HOST=localhost" \
  --env "DB_PORT=5432" \
  --scope user

MCP List and Remove Commands

gemini mcp list                       # List configured MCP servers
gemini mcp remove <name>              # Remove MCP server by name

Extension Management

Commands for managing CLI extensions.

gemini extensions <command> [options]

Extension Commands

gemini extensions install <source>    # Install extension from source
gemini extensions uninstall <name>    # Remove extension by name
gemini extensions list                # Show installed extensions
gemini extensions update [name]       # Update extension(s)
gemini extensions enable <name>       # Enable extension
gemini extensions disable <name>      # Disable extension
gemini extensions link <path>         # Link local extension for development
gemini extensions new <name>          # Create new extension template

Usage Examples:

# Install from GitHub
gemini extensions install https://github.com/user/gemini-ext-example

# Install from local directory
gemini extensions install ./my-extension

# Update specific extension
gemini extensions update my-extension

# Update all extensions
gemini extensions update

# Link for development
gemini extensions link ./development/my-extension

Environment Variables

Runtime Configuration

GEMINI_MODEL                    # Default model to use
NO_COLOR                        # Disable colors (activates no-color theme)
DEBUG / DEBUG_MODE              # Enable debug mode
CLOUD_SHELL                     # Indicates Cloud Shell environment
SANDBOX                         # Indicates sandbox environment
GEMINI_CLI_NO_RELAUNCH         # Prevent memory-based relaunching

HTTP Configuration

HTTPS_PROXY / https_proxy       # HTTPS proxy configuration
HTTP_PROXY / http_proxy         # HTTP proxy configuration

Telemetry Configuration

OTEL_EXPORTER_OTLP_ENDPOINT    # OpenTelemetry OTLP endpoint

CLI Arguments Interface

Internal CLI arguments structure (not exposed for programmatic use):

interface CliArgs {
  // Model and generation
  model?: string;
  prompt?: string;
  promptInteractive?: string;

  // Execution environment
  sandbox?: boolean | string;
  debug?: boolean;
  yolo?: boolean;
  approvalMode?: 'default' | 'auto_edit' | 'yolo';

  // Context and files
  allFiles?: boolean;
  includeDirectories?: string[];
  checkpointing?: boolean;

  // Tool configuration
  allowedTools?: string[];
  allowedMcpServerNames?: string[];
  extensions?: string[];
  listExtensions?: boolean;

  // Telemetry and monitoring
  telemetry?: boolean;
  telemetryTarget?: 'local' | 'gcp';
  telemetryOtlpEndpoint?: string;
  telemetryOtlpProtocol?: 'grpc' | 'http';
  telemetryLogPrompts?: boolean;
  telemetryOutfile?: string;
  showMemoryUsage?: boolean;

  // UI and accessibility
  screenReader?: boolean;
  sessionSummary?: string;
  proxy?: string;
  experimentalAcp?: boolean;

  // Positional arguments
  promptWords?: string[];
}

Install with Tessl CLI

npx tessl i tessl/npm-google--gemini-cli

docs

cli-interface.md

configuration.md

extensions.md

index.md

interactive-commands.md

mcp-integration.md

themes.md

tile.json