g

command module
v1.0.0 Latest Latest
Warning

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

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

README ΒΆ

g logo

Go Release License CI

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

Why g? β€’ Installation β€’ Quick Start β€’ MCP β€’ Benchmarks


⚑ Why g?

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.

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

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

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

πŸ“¦ Installation

⚠️ Prerequisites (Required)

g 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"

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

Homebrew

brew install k-sub1995/tap/g

Go

go install github.com/k-sub1995/g@latest

Binary

Download from Releases

πŸš€ Quick Start

CLI Mode

Pass a prompt directly:

g "What is the capital of Japan?"

TUI Mode

Launch interactive TUI (Text User Interface):

g

The TUI provides:

  • Interactive prompt editing with arrow key navigation
  • Real-time streaming responses
  • Command history

πŸ“‹ Usage

g [prompt] [flags]
g mcp <command>
g version

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

MCP Commands:
  g mcp list                 List MCP servers and tools
  g mcp call <server> <tool> Call an MCP tool

Version Command:
  g version                  Print the version number of g

πŸ”Œ MCP Support

g supports Model Context Protocol servers.

Configure in ~/.gemini/settings.json:

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

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

πŸ“Š Benchmarks

Metric g Official CLI Improvement
Startup 23ms 847ms 37x
Binary 5.6MB ~200MB 35x
Runtime None Node.js -

πŸ—οΈ Build

git clone https://github.com/k-sub1995/g.git
cd g
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

πŸ“„ 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
Package agent provides the agentic loop for gmn.
Package agent provides the agentic loop for gmn.
Package api provides a client for the Gemini API.
Package api provides a client for the Gemini API.
Package auth provides OAuth authentication for geminimini.
Package auth provides OAuth authentication for geminimini.
Package cmd provides MCP command for g.
Package cmd provides MCP command for g.
Package config provides configuration loading for g.
Package config provides configuration loading for g.
Package extension provides extension loading for gmn.
Package extension provides extension loading for gmn.
Package input provides input handling for geminimini.
Package input provides input handling for geminimini.
internal
agent
Package agent provides the agentic loop for gmn.
Package agent provides the agentic loop for gmn.
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.
config
Package config provides configuration loading for geminimini.
Package config provides configuration loading for geminimini.
extension
Package extension provides extension loading for gmn.
Package extension provides extension loading for gmn.
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.
prompt
Package prompt provides system prompt construction for gmn.
Package prompt provides system prompt construction for gmn.
tools
Package tools provides tool implementations used by the Gemini agent.
Package tools provides tool implementations used by the Gemini agent.
Package mcp provides MCP (Model Context Protocol) client implementation.
Package mcp provides MCP (Model Context Protocol) client implementation.
Package output provides output formatting for geminimini.
Package output provides output formatting for geminimini.
Package prompt provides system prompt construction for gmn.
Package prompt provides system prompt construction for gmn.
Package tools provides tool implementations used by the Gemini agent.
Package tools provides tool implementations used by the Gemini agent.

Jump to

Keyboard shortcuts

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