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:
@@ -1,15 +1,8 @@
|
||||
// gt is the Gas Town CLI for managing multi-agent workspaces.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
import "github.com/steveyegge/gastown/internal/cmd"
|
||||
|
||||
func main() {
|
||||
fmt.Println("gt - Gas Town CLI")
|
||||
fmt.Println("Version: 0.0.1 (development)")
|
||||
if len(os.Args) > 1 {
|
||||
fmt.Printf("Command: %s\n", os.Args[1])
|
||||
fmt.Println("Not yet implemented. See gastown-py for current functionality.")
|
||||
}
|
||||
cmd.Execute()
|
||||
}
|
||||
|
||||
18
go.mod
18
go.mod
@@ -1,3 +1,21 @@
|
||||
module github.com/steveyegge/gastown
|
||||
|
||||
go 1.23
|
||||
|
||||
require (
|
||||
github.com/charmbracelet/lipgloss v1.0.0
|
||||
github.com/spf13/cobra v1.8.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.4.2 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/muesli/termenv v0.15.2 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
)
|
||||
|
||||
30
go.sum
Normal file
30
go.sum
Normal file
@@ -0,0 +1,30 @@
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||
github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg=
|
||||
github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo=
|
||||
github.com/charmbracelet/x/ansi v0.4.2 h1:0JM6Aj/g/KC154/gOP4vfxun0ff6itogDYk41kof+qk=
|
||||
github.com/charmbracelet/x/ansi v0.4.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
|
||||
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
29
internal/cmd/root.go
Normal file
29
internal/cmd/root.go
Normal 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
30
internal/cmd/version.go
Normal 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
65
internal/style/style.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user