feat: add Cobra CLI scaffolding with Lipgloss styles

- cmd/gt/main.go: Entry point using Cobra
- internal/cmd/root.go: Root command with description
- internal/cmd/version.go: Version command with build info
- internal/style/style.go: Lipgloss styles for terminal output

Closes gt-u1j.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-16 13:19:27 -08:00
parent 008eb6ba3a
commit 7217b34a90
6 changed files with 175 additions and 10 deletions

29
internal/cmd/root.go Normal file
View File

@@ -0,0 +1,29 @@
// Package cmd provides CLI commands for the gt tool.
package cmd
import (
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "gt",
Short: "Gas Town - Multi-agent workspace manager",
Long: `Gas Town (gt) manages multi-agent workspaces called rigs.
It coordinates agent spawning, work distribution, and communication
across distributed teams of AI agents working on shared codebases.`,
}
// Execute runs the root command
func Execute() {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
func init() {
// Global flags can be added here
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file")
}

30
internal/cmd/version.go Normal file
View File

@@ -0,0 +1,30 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/style"
)
// Version information - set at build time via ldflags
var (
Version = "0.1.0"
BuildTime = "unknown"
GitCommit = "unknown"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print version information",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(style.Bold.Render("gt") + " - Gas Town CLI")
fmt.Printf("Version: %s\n", Version)
fmt.Printf("Commit: %s\n", style.Dim.Render(GitCommit))
fmt.Printf("Built: %s\n", style.Dim.Render(BuildTime))
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}

65
internal/style/style.go Normal file
View File

@@ -0,0 +1,65 @@
// Package style provides consistent terminal styling using Lipgloss.
package style
import "github.com/charmbracelet/lipgloss"
var (
// Success style for positive outcomes
Success = lipgloss.NewStyle().
Foreground(lipgloss.Color("10")). // Green
Bold(true)
// Warning style for cautionary messages
Warning = lipgloss.NewStyle().
Foreground(lipgloss.Color("11")). // Yellow
Bold(true)
// Error style for failures
Error = lipgloss.NewStyle().
Foreground(lipgloss.Color("9")). // Red
Bold(true)
// Info style for informational messages
Info = lipgloss.NewStyle().
Foreground(lipgloss.Color("12")) // Blue
// Dim style for secondary information
Dim = lipgloss.NewStyle().
Foreground(lipgloss.Color("8")) // Gray
// Bold style for emphasis
Bold = lipgloss.NewStyle().
Bold(true)
// SuccessPrefix is the checkmark prefix for success messages
SuccessPrefix = Success.Render("✓")
// WarningPrefix is the warning prefix
WarningPrefix = Warning.Render("⚠")
// ErrorPrefix is the error prefix
ErrorPrefix = Error.Render("✗")
// ArrowPrefix for action indicators
ArrowPrefix = Info.Render("→")
)
// RenderSuccess formats a success message
func RenderSuccess(msg string) string {
return SuccessPrefix + " " + msg
}
// RenderWarning formats a warning message
func RenderWarning(msg string) string {
return WarningPrefix + " " + msg
}
// RenderError formats an error message
func RenderError(msg string) string {
return ErrorPrefix + " " + msg
}
// RenderInfo formats an info message with arrow
func RenderInfo(msg string) string {
return ArrowPrefix + " " + msg
}