Files
gastown/internal/doctor/commands_check.go
Ryan Snodgrass e1f2bb8b4b feat(ui): import comprehensive UX system from beads
Import beads' UX design system into gastown:

- Add internal/ui/ package with Ayu theme colors and semantic styling
  - styles.go: AdaptiveColor definitions for light/dark mode
  - terminal.go: TTY detection, NO_COLOR/CLICOLOR support
  - markdown.go: Glamour rendering with agent mode bypass
  - pager.go: Smart paging with GT_PAGER support

- Add colorized help output (internal/cmd/help.go)
  - Group headers in accent color
  - Command names styled for scannability
  - Flag types and defaults muted

- Add gt thanks command (internal/cmd/thanks.go)
  - Contributor display with same logic as bd thanks
  - Styled with Ayu theme colors

- Update gt doctor to match bd doctor UX
  - Category grouping (Core, Infrastructure, Rig, Patrol, etc.)
  - Semantic icons (✓ ⚠ ✖) with Ayu colors
  - Tree connectors for detail lines
  - Summary line with pass/warn/fail counts
  - Warnings section at end with numbered issues

- Migrate existing styles to use ui package
  - internal/style/style.go uses ui.ColorPass etc.
  - internal/tui/feed/styles.go uses ui package colors

Co-Authored-By: SageOx <ox@sageox.ai>
2026-01-09 22:46:06 -08:00

77 lines
2.1 KiB
Go

package doctor
import (
"fmt"
"strings"
"github.com/steveyegge/gastown/internal/templates"
)
// CommandsCheck validates that town-level .claude/commands/ is provisioned.
// All agents inherit these via Claude's directory traversal - no per-workspace copies needed.
type CommandsCheck struct {
FixableCheck
townRoot string // Cached for Fix
missingCommands []string // Cached during Run for use in Fix
}
// NewCommandsCheck creates a new commands check.
func NewCommandsCheck() *CommandsCheck {
return &CommandsCheck{
FixableCheck: FixableCheck{
BaseCheck: BaseCheck{
CheckName: "commands-provisioned",
CheckDescription: "Check .claude/commands/ is provisioned at town level",
CheckCategory: CategoryConfig,
},
},
}
}
// Run checks if town-level slash commands are provisioned.
func (c *CommandsCheck) Run(ctx *CheckContext) *CheckResult {
c.townRoot = ctx.TownRoot
c.missingCommands = nil
// Check town-level commands
missing, err := templates.MissingCommands(ctx.TownRoot)
if err != nil {
return &CheckResult{
Name: c.Name(),
Status: StatusWarning,
Message: fmt.Sprintf("Error checking town-level commands: %v", err),
}
}
if len(missing) == 0 {
// Get command names for the success message
names, _ := templates.CommandNames()
return &CheckResult{
Name: c.Name(),
Status: StatusOK,
Message: fmt.Sprintf("Town-level slash commands provisioned (%s)", strings.Join(names, ", ")),
}
}
c.missingCommands = missing
return &CheckResult{
Name: c.Name(),
Status: StatusWarning,
Message: fmt.Sprintf("Missing town-level slash commands: %s", strings.Join(missing, ", ")),
Details: []string{
fmt.Sprintf("Expected at: %s/.claude/commands/", ctx.TownRoot),
"All agents inherit town-level commands via directory traversal",
},
FixHint: "Run 'gt doctor --fix' to provision missing commands",
}
}
// Fix provisions missing slash commands at town level.
func (c *CommandsCheck) Fix(ctx *CheckContext) error {
if len(c.missingCommands) == 0 {
return nil
}
return templates.ProvisionCommands(c.townRoot)
}