Skip to content

Components

The pkg directory contains the reusable library components that power gtb applications. These packages are designed to be modular, testable, and strictly typed.

Core Components

Component Package Description
Props pkg/props The dependency injection container. Holds global state like configuration, logger, and filesystem interfaces.
Config pkg/config Robust configuration management wrapping generic Viper usage with type safety and interface-based testability.
Commands cmd/ Built-in Cobra commands for configuration (init), updates (version, update), interactive browser (docs), and agentic workflows (mcp).
Error Handling pkg/errorhandling Centralized error reporting and formatting, ensuring consistent exit codes and log output.

Advanced Features

Component Package Description
Controls pkg/controls Service orchestration and lifecycle management for long-running processes (e.g., servers, watchers).
Setup pkg/setup bootstrapping logic for tool initialization, including GitHub authentication and self-updates.
Version Control pkg/vcs Abstractions for git operations and GitHub API interactions, handling enterprise auth complexity.
Chat pkg/chat Multi-provider AI client (OpenAI, Anthropic, Gemini) for building intelligent features.
Docs pkg/docs Logic for the interactive TUI documentation browser.
Forms pkg/forms Multi-step interactive CLI form helpers with Escape-to-go-back navigation, built on charmbracelet/huh.
Utils pkg/utils General-purpose utility functions for path resolution and system checks.

Testing Support

Component Package Description
Mocks pkg/mocks Auto-generated Mockery definitions for all core interfaces to simplify unit testing.

Internal Development

  • Internal Packages: Documentation for the private internal/ packages that power the CLI generator itself. (Contributors Only)