gemini-cli

📁 gswangg/gemini-cli 📅 Feb 10, 2026
2
总安装量
2
周安装量
#70173
全站排名
安装命令
npx skills add https://github.com/gswangg/gemini-cli --skill gemini-cli

Agent 安装分布

claude-code 2
mcpjam 1
kilo 1
junie 1
windsurf 1
zencoder 1

Skill 文档

Gemini CLI

Gemini CLI for interactive and non-interactive AI tasks. Use -p for non-interactive mode.

Preferred Defaults

Unless otherwise specified, use these settings:

gemini -m gemini-3-pro-preview -p "your prompt"
  • -m gemini-3-pro-preview – Preferred model
  • -p – Non-interactive prompt mode

Basic Usage

# Non-interactive with prompt
gemini -p "your prompt here"

# Read prompt from stdin
echo "your prompt" | gemini -p ""

# Interactive mode
gemini

# Interactive with initial prompt
gemini -i "start with this prompt"

# Positional prompt (one-shot)
gemini "your query here"

Key Options

Model Selection

-m, --model <MODEL>        # Specify model (e.g., "gemini-3-pro-preview")

Approval Modes

-y, --yolo                 # Auto-approve all tool calls
--approval-mode <MODE>     # Set approval mode
Mode Description
default Prompt for approval
auto_edit Auto-approve edit tools
yolo Auto-approve all tools
plan Read-only mode

Sandbox

-s, --sandbox              # Run in sandbox mode

Session Management

-r, --resume <ID>          # Resume session ("latest" or index number)
--list-sessions            # List available sessions
--delete-session <ID>      # Delete session by index

Output Format

-o, --output-format <FORMAT>
Format Description
text Plain text output (default)
json JSON with session_id, response, and stats
stream-json Streaming JSONL events

Workspace

--include-directories <DIR>  # Additional directories to include (comma-separated or multiple flags)

Extensions and Tools

-e, --extensions <EXT>       # Specific extensions to use (default: all)
-l, --list-extensions        # List available extensions
--allowed-tools <TOOLS>      # Tools allowed without confirmation
--allowed-mcp-server-names <NAMES>  # Allowed MCP server names

Other Options

-d, --debug                  # Debug mode (F12 opens debug console)
--screen-reader              # Enable screen reader accessibility

Output Formats

JSON Output (-o json)

Returns object with:

  • session_id – Session UUID
  • response – Final response text
  • stats – Token usage and tool call stats per model

Stream JSON Output (-o stream-json)

Streaming JSONL events:

Event Type Description
init Session started, includes session_id and model
message User or assistant message with role and content
result Final result with status and stats

Common Patterns

Default Invocation

gemini -m gemini-3-pro-preview -p "your task"

With YOLO Mode

gemini -m gemini-3-pro-preview -y -p "your task"

With Output Capture

gemini -m gemini-3-pro-preview -p "your task" -o json > result.json

Resume Latest Session

gemini -r latest

Include Additional Directories

gemini -m gemini-3-pro-preview --include-directories /path/to/other -p "your task"

Subcommands

gemini mcp                  # Manage MCP servers
gemini extensions <cmd>     # Manage extensions
gemini skills <cmd>         # Manage agent skills
gemini hooks <cmd>          # Manage hooks

Notes

  • Use -p for non-interactive/scripted usage
  • Use -i to start interactive with an initial prompt
  • Positional arguments are treated as one-shot queries
  • Session resume uses index numbers from --list-sessions or “latest”