godoctor

module
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0

README

GoDoctor - Specialized Agentic Coding Suite for Go

GoDoctor is a specialized and optimized suite of tools and skills carefully engineered to elevate agentic coding in Go codebases. Whenever installed, coding agents operating on Go codebases MUST use GoDoctor's specialized tools (smart_build, smart_edit, smart_read, describe_symbol, add_dependency, read_docs, mutation_test, test_query, list_files) to navigate, edit, compile, test, and analyze Go code.

User Instructions

Installation

Run the automatic installation script:

./install.sh [options]

This script detects your platform (OS and architecture), fetches the latest release, and installs GoDoctor for your target environment:

  • Antigravity 2.0 (Plugin) (Default):
    ./install.sh --target agy2      # Global: ~/.gemini/config/plugins/godoctor
    ./install.sh --target agy2 -w   # Workspace: .agents/plugins/godoctor
    
  • Antigravity CLI (Plugin):
    ./install.sh --target cli       # Global: ~/.gemini/antigravity-cli/plugins/godoctor
    ./install.sh --target cli -w    # Workspace: .agents/plugins/godoctor
    
  • Other Agents (Skills Only):
    ./install.sh --target skills    # Global: ~/.agents/skills
    ./install.sh --target skills -w # Workspace: .agents/skills
    
Usage Instructions

Once installed, GoDoctor runs automatically in the background of your agent-compatible client. The client agent will discover and call the exposed tools during Go programming tasks.

To manually print system instructions for an LLM agent:

godoctor --agents

To see the list of active tools:

godoctor --list-tools
Specific Documentation
Command Interception (Hooks)

When running inside the Antigravity CLI, GoDoctor intercepts standard terminal commands (such as go build, cat, or sed) and raw file tools when they operate on Go source files (.go). It redirects the agent to GoDoctor's specialized tools (smart_build, smart_read, and smart_edit). Non-Go files (Python, TypeScript, Markdown, etc.) are unaffected and pass through normally. This prevents syntax errors and conserves context window tokens.

Configuration (Command-line Flags)
Flag Description Default
--allow Comma-separated whitelist of tools to enable. ""
--disable Comma-separated list of tools to disable. ""
--listen Address for HTTP transport (defaults to standard input/output). ""
--list-tools Prints all registered tools and exits. false
--agents Prints system instructions for LLM agents and exits. false
--version Prints the version and exits. false
Features and Tools

GoDoctor provides tools divided into four functional areas:

Code Navigation
  • list_files lists files in the workspace while avoiding version control directories.
  • smart_read reads files, extracts code outlines, and appends definitions of referenced types. Powered by a high-performance persistent background gopls daemon over a stateful JSON-RPC session, delivering type-tags in milliseconds.
  • describe_symbol provides semantic detail for any symbol, including declaration signatures, comments, and references, querying the shared background gopls process instantly.
Code Editing
  • smart_edit handles atomic modifications across multiple files. It formats the code and automatically rolls back changes if the compiler detects a syntax error.
Go Toolchain Integration
  • smart_build manages module tidying, code modernization, formatting, compiling, testing, and linting.
  • add_dependency installs Go modules and pulls their documentation.
  • read_docs fetches API documentation for packages and symbols.
Testing
  • mutation_test runs Selene mutation tests to check test coverage quality.
  • test_query queries test results and coverage data using SQL.

Developer Instructions

Building

Build the project from source using the Makefile:

git clone https://github.com/danicat/godoctor.git
cd godoctor
make build

This compiles the server binary to bin/godoctor.

To install the binary globally to your $GOPATH/bin:

make install
Testing & Build Pipeline

Run GoDoctor's specialized build pipeline:

smart_build

This automatically handles module tidying, code modernization, formatting (gofmt), compiling (go build), test execution (go test), and static linting in a single optimized operation.

Running Locally

Run the compiled binary directly to test behavior:

./bin/godoctor

Check active tools:

./bin/godoctor --list-tools
Releasing

Releasing a new version is automated into a single one-liner command:

make bump-version VERSION=0.21.0

This single command automatically:

  1. Updates "version" in plugin.json.
  2. Stages and commits plugin.json (chore: bump version to 0.21.0).
  3. Creates the matching Git release tag (v0.21.0).
  4. Pushes main branch and tags to GitHub (git push origin main --tags), triggering the automated GoReleaser CI/CD pipeline.
Local Snapshot Testing (Optional)

To test the GoReleaser build configuration locally without creating a release tag:

make snapshot

License

Apache 2.0

Directories

Path Synopsis
cmd
godoctor command
Package main is the entry point for the godoctor MCP server.
Package main is the entry point for the godoctor MCP server.
internal
config
Package config handles the loading and management of the application's configuration.
Package config handles the loading and management of the application's configuration.
godoc
Package godoc implements the core logic for retrieving and parsing Go documentation.
Package godoc implements the core logic for retrieving and parsing Go documentation.
hooks
Package hooks implements pre-invocation interception rules for Antigravity tools.
Package hooks implements pre-invocation interception rules for Antigravity tools.
instructions
Package instructions generates dynamic system instructions for the AI agent.
Package instructions generates dynamic system instructions for the AI agent.
lsp
Package lsp implements a stateful, persistent JSON-RPC Language Server Protocol (LSP) client for multiplexing language analysis queries directly to a single, persistent gopls daemon.
Package lsp implements a stateful, persistent JSON-RPC Language Server Protocol (LSP) client for multiplexing language analysis queries directly to a single, persistent gopls daemon.
prompts
Package prompts defines the prompts available in the MCP server.
Package prompts defines the prompts available in the MCP server.
resources/godoc
Package godoc implements the godoc resource handler.
Package godoc implements the godoc resource handler.
safeshell
Package safeshell provides a secure wrapper for subprocess command execution to prevent shell injection.
Package safeshell provides a secure wrapper for subprocess command execution to prevent shell injection.
server
Package server implements the Model Context Protocol (MCP) server for godoctor.
Package server implements the Model Context Protocol (MCP) server for godoctor.
textdist
Package textdist provides text distance algorithms for fuzzy matching.
Package textdist provides text distance algorithms for fuzzy matching.
toolnames
Package toolnames defines the registry of available tools for the godoctor server.
Package toolnames defines the registry of available tools for the godoctor server.
tools/file/edit
Package edit implements the file editing tool with atomic multi-file transactions, formatting, compiler gates, and spelling aids.
Package edit implements the file editing tool with atomic multi-file transactions, formatting, compiler gates, and spelling aids.
tools/file/list
Package list implements the file listing tool.
Package list implements the file listing tool.
tools/file/outline
Package outline implements the file outlining tool.
Package outline implements the file outlining tool.
tools/file/read
Package read implements the code reading and symbol extraction tool with unconditional type enrichment.
Package read implements the code reading and symbol extraction tool with unconditional type enrichment.
tools/go/build
Package build implements the smart_build tool.
Package build implements the smart_build tool.
tools/go/docs
Package docs implements the documentation retrieval tool.
Package docs implements the documentation retrieval tool.
tools/go/get
Package get implements the go get tool.
Package get implements the go get tool.
tools/go/mutation
Package mutation implements the mutation testing tool using selene.
Package mutation implements the mutation testing tool using selene.
tools/go/navigation
Package navigation implements tools for navigating Go source code.
Package navigation implements tools for navigating Go source code.
tools/go/project
Package project implements tools for managing Go projects.
Package project implements tools for managing Go projects.
tools/go/testquery
Package testquery implements the test query tool using tq.
Package testquery implements the test query tool using tq.
tools/shared
Package shared provides shared utilities for GoDoctor tools.
Package shared provides shared utilities for GoDoctor tools.

Jump to

Keyboard shortcuts

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