What is Go Tool Base (GTB)?¶
Modern CLI tools, DevOps workflows, and developer utilities demand far more than basic flag parsing. Go Tool Base (GTB) is a comprehensive lifecycle framework that makes Go applications Agentic, Self-sustaining, and Self-documenting out of the box.
It provides the "batteries included" experience of a macro-framework (like Rails or Laravel), but meticulously tailored for Go command-line applications and beyond.
β What GTB IS¶
- A full-lifecycle application framework for Go β covering configuration, versioning, auto-updates, embedded documentation, error handling, and AI integration.
- A CLI-first framework β its default mode is building command-line tools with a rich set of built-in commands (
init,version,update,docs,mcp). - A dependency injection container β the
Propsstruct orchestrates services (config, assets, logging, VCS, AI) and is explicitly passed to commands for ultimate testability. - A scaffold and generator β
gtb generate skeletoncreates a ready-to-ship, robustly structured project in seconds. - A general-purpose application bootstrap β while CLI is the primary interface, GTB's
Propscontainer and lifecycle management can power any Go application: web services, daemons, background workers, or hybrid tools.
β What GTB is NOT¶
- NOT a web framework. It does not provide HTTP routers, middleware pipelines, or HTML template engines. It is not a competitor to Gin, Echo, Fiber, or Buffalo. (However, a GTB-bootstrapped CLI tool could easily embed a web server as one of its subcommands).
- NOT a microservice scaffold. It does not generate gRPC boilerplate like Sponge or Go-Blueprint.
- NOT just a command router. Unlike Cobra (a library for routing commands), GTB is an opinionated framework providing the entire application lifecycle around the router.
- NOT a TUI component library. It is not a replacement for Bubble Tea. It uses those libraries under the hood, wrapping them in a managed lifecycle.
π Key Advantages & "Wow" Factors¶
- Integrated AI Assistant (
docs ask)
Your tool ships with a built-in expert. Users ask questions in natural language, and the AI answers using only your embedded docsβzero hallucination by design. - Autonomous Tool Calling (Agentic Workflows)
The AI can call local Go functions, inspect state, and iterate. This allows for true ReAct-style agent loops, not just text generation. - Built-in Lifecycle Management
Version checking via GitHub/GitLab, auto-updates (update), and environment bootstrapping (init) are zero-config. - Rich TUI Documentation
Interactive, searchable, Markdown-rendered documentation directly in the terminalβno browser needed. - Model Context Protocol (MCP)
Expose your tool's capabilities to external AI agents out-of-the-box. Your CLI becomes an AI-native building block. - Zero Lock-in (The "Eject Path")
GTB generates idiomatic, standard-library-compliant Go code. If you outgrow the framework, the generated code stands on its own. - Architectural Consistency at Scale
In enterprises running dozens of internal tools, GTB enforces a standardised layout, eliminating per-team architectural debates. - Convention over Configuration
Sensible defaults, a standard project structure, and predictable DI. A massive productivity multiplier for teams migrating from Laravel, Rails, or Django.
π CLI-First, Not CLI-Only¶
While GTB is designed around a CLI interface, its architecture is application-agnostic.
Start with a CLI. Grow into whatever you need:
| Use Case | How GTB Helps |
|---|---|
| CLI Utilities | Full built-in command suite, auto-updates, TUI docs |
| Long-Running Daemons | Use Props for DI, add a run command for the daemon loop |
| Web Services | Scaffold with GTB, add a serve command that boots an HTTP router |
| DevOps Automation | K8s init containers, migration runners, and automated setups |