gmn

command module
v0.0.0-...-92d3d5c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README ยถ

gmn logo

Go Release License CI

A lightweight Gemini CLI written in Go
A love letter to Google's Gemini CLI

Why gmn? โ€ข Installation โ€ข Quick Start โ€ข Chat Mode โ€ข Tools โ€ข MCP โ€ข Benchmarks


โšก Why gmn?

The official Gemini CLI is an amazing tool with excellent MCP support and seamless Google authentication. However, for scripting and automation, its Node.js runtime adds startup overhead.

gmn reimplements the core functionality in Go, achieving ~40x faster startup while maintaining full compatibility with the official CLI's authentication.

$ time gmn "hi" > /dev/null
0.02s user 0.01s system

$ time gemini -p "hi" > /dev/null
0.94s user 0.20s system

โœจ Features

  • Fast startup โ€” Native Go binary, no runtime overhead
  • Interactive chat mode โ€” Rich TUI with multi-turn conversations
  • Built-in tools โ€” File operations, web search, shell commands
  • YOLO mode โ€” Skip confirmations for automated workflows (--yolo)
  • Session stats โ€” Token usage tracking with Ctrl+C graceful exit
  • Gemini 3 Pro support โ€” Full compatibility with gemini-3-pro-preview
  • MCP support โ€” Connect to Model Context Protocol servers
  • Credential reuse โ€” Uses existing Gemini CLI authentication

๐Ÿ“ฆ Installation

โš ๏ธ Prerequisites (Required)

gmn does not have its own authentication. You must authenticate once using the official Gemini CLI first:

npm install -g @google/gemini-cli
gemini  # Choose "Login with Google"

gmn reuses these credentials automatically from ~/.gemini/. Your free tier quota or Workspace Code Assist quota applies.

Go

go install github.com/linkalls/gmn@latest

Binary

Download from Releases

๐Ÿš€ Quick Start

# Simple prompt (one-shot)
gmn "Explain quantum computing"

# Interactive chat mode
gmn chat

# Chat with specific model (tab completion available)
gmn chat -m gemini-3-pro-preview

# Chat with initial prompt
gmn chat -p "Review this codebase"

# With file context
gmn "Review this code" -f main.go

# Pipe input
cat error.log | gmn "What's wrong?"

# JSON output
gmn "List 3 colors" -o json

๐Ÿ’ฌ Interactive Chat

Start an interactive session with a rich TUI and tool execution support:

gmn chat                              # Default model (gemini-2.5-flash)
gmn chat -m gemini-3-pro-preview      # Use Gemini 3 Pro
gmn chat -p "explain this codebase"   # Start with a prompt
gmn chat -r last                      # Resume the last session
gmn chat -r my-project                # Resume a named session
gmn chat --yolo                       # Skip all confirmations (dangerous!)
gmn chat --shell /bin/zsh             # Use custom shell

TUI Features

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  โœจ gmn   gemini-3-pro-preview       โ”‚
โ”‚  ๐Ÿ“ /path/to/your/project            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
Type /help for commands, /exit to quit

โฏ _
  • Rich header โ€” Model badge, working directory, YOLO indicator
  • Thinking indicator โ€” Spinner while waiting for response
  • Tool notifications โ€” Visual feedback for tool calls
  • Session persistence โ€” Auto-save conversations, resume anytime
  • Session stats โ€” Token usage on exit (including Ctrl+C)
  • Tab completion โ€” Auto-complete models and commands
  • Command history โ€” Navigate with Up/Down arrows

Chat Commands

Command Description
/help, /h Show available commands
/exit, /q Exit with session stats
/clear Clear conversation history
/stats Show current token usage
/model Show current model and available models
/model <name> Switch model (e.g., /model gemini-2.5-flash)
/sessions List all saved sessions
/save [name] Save current session (optional name)
/load <id> Load a saved session
Ctrl+C Exit gracefully with session stats

๐Ÿ”ง Built-in Tools

In chat mode, Gemini can automatically call these tools:

Tool Description Confirmation
list_directory List contents of a directory No
read_file Read file contents No
write_file Write content to a file Yes
edit_file Edit file by replacing text Yes
glob Find files matching a pattern No
search_file_content Search for text/regex in files No
web_search Search the web (DuckDuckGo) No
web_fetch Fetch and parse web pages Yes
shell Execute shell commands Yes

Confirmation Prompt

For dangerous operations, gmn shows a rich confirmation dialog:

โ•ญโ”€ Allow Shell Command? โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  Command: rm -rf ./build                  โ”‚
โ”‚                                           โ”‚
โ”‚  [y] Yes  [n] No  [a] Always allow shell  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Use --yolo to skip all confirmations (be careful!).

๐Ÿ“‹ Usage

gmn [prompt] [flags]
gmn chat [flags]
gmn mcp <command>

Commands:
  chat                         Start interactive chat session
  mcp list                     List MCP servers and tools
  mcp call <server> <tool>     Call an MCP tool

Global Flags:
  -p, --prompt string          Prompt (alternative to positional arg)
  -m, --model string           Model (default "gemini-2.5-flash")
  -f, --file strings           Files to include
  -o, --output-format string   text, json, stream-json (default "text")
  -t, --timeout duration       Timeout (default 5m)
      --debug                  Debug output
  -v, --version                Version

Chat Flags:
  -p, --prompt string          Initial prompt to send
  -m, --model string           Model (default based on tier)
  -f, --file strings           Files to include in context
  -r, --resume string          Resume a session (ID, name, or 'last')
      --yolo                   Skip all confirmation prompts
      --shell string           Custom shell path (default: auto-detect)

Supported Models

Model Tier Notes
gemini-2.5-flash Free / Standard Default, fast responses
gemini-2.5-pro Free / Standard More capable
gemini-3-pro-preview Standard Latest, best for coding
gemini-3-flash-preview Standard Fast Gemini 3

๐Ÿ”Œ MCP Support

gmn supports Model Context Protocol servers.

Configure in ~/.gemini/settings.json:

{
  "mcpServers": {
    "my-server": {
      "command": "/path/to/mcp-server"
    }
  }
}
# List available tools
gmn mcp list

# Call a tool
gmn mcp call my-server tool-name arg=value

๐Ÿ“Š Benchmarks

Metric gmn Official CLI Improvement
Startup ~20ms ~850ms ~40x
Binary ~11MB ~200MB ~18x
Runtime None Node.js -

Measured on macOS/Linux. Windows startup may vary.

๐Ÿ—๏ธ Build

git clone https://github.com/linkalls/gmn.git
cd gmn
make build          # Current platform
make cross-compile  # All platforms

๐Ÿšซ What's NOT Included

  • OAuth flow โ†’ authenticate with official CLI first
  • API Key / Vertex AI auth
  • Some advanced official CLI features

๐Ÿ“„ License

Apache License 2.0 โ€” See LICENSE

This project is a derivative work based on Gemini CLI by Google LLC.

๐Ÿ™ Acknowledgments

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis
MCP command for gmn Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0
MCP command for gmn Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0
internal
api
Package api provides a client for the Gemini API.
Package api provides a client for the Gemini API.
auth
Package auth provides OAuth authentication for geminimini.
Package auth provides OAuth authentication for geminimini.
cli
Package cli provides CLI utilities for gmn.
Package cli provides CLI utilities for gmn.
config
Package config provides configuration loading for geminimini.
Package config provides configuration loading for geminimini.
confirmation
Package confirmation provides TUI-based confirmation prompts for destructive operations.
Package confirmation provides TUI-based confirmation prompts for destructive operations.
input
Package input provides input handling for geminimini.
Package input provides input handling for geminimini.
mcp
Package mcp provides MCP (Model Context Protocol) client implementation.
Package mcp provides MCP (Model Context Protocol) client implementation.
output
Package output provides output formatting for geminimini.
Package output provides output formatting for geminimini.
session
Package session provides session management for gmn chat.
Package session provides session management for gmn chat.
tools
Package tools provides built-in tool implementations for the Gemini CLI.
Package tools provides built-in tool implementations for the Gemini CLI.
tui
Package tui provides a full-featured terminal user interface for gmn.
Package tui provides a full-featured terminal user interface for gmn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL