Files
gastown/internal/doctor/town_git_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

73 lines
1.9 KiB
Go

package doctor
import (
"os"
"path/filepath"
)
// TownGitCheck verifies that the town root directory is under version control.
// Having the town harness in git is optional but recommended for:
// - Backing up personal Gas Town configuration and operating history
// - Tracking mail and coordination beads
// - Easier federation across machines
type TownGitCheck struct {
BaseCheck
}
// NewTownGitCheck creates a new town git version control check.
func NewTownGitCheck() *TownGitCheck {
return &TownGitCheck{
BaseCheck: BaseCheck{
CheckName: "town-git",
CheckDescription: "Verify town root is under version control",
CheckCategory: CategoryCore,
},
}
}
// Run checks if the town root has a .git directory.
func (c *TownGitCheck) Run(ctx *CheckContext) *CheckResult {
gitDir := filepath.Join(ctx.TownRoot, ".git")
info, err := os.Stat(gitDir)
if os.IsNotExist(err) {
return &CheckResult{
Name: c.Name(),
Status: StatusWarning,
Message: "Town root is not under version control",
Details: []string{
"Your town harness contains personal configuration and operating history",
"Version control makes it easier to backup and federate across machines",
},
FixHint: "Run 'git init' in your town root to initialize a repository",
}
}
if err != nil {
return &CheckResult{
Name: c.Name(),
Status: StatusError,
Message: "Failed to check town git status: " + err.Error(),
}
}
// Verify it's actually a directory (not a file named .git)
if !info.IsDir() {
return &CheckResult{
Name: c.Name(),
Status: StatusWarning,
Message: "Town root .git is not a directory",
Details: []string{
"Expected .git to be a directory, but it's a file",
"This may indicate a git worktree or submodule configuration",
},
}
}
return &CheckResult{
Name: c.Name(),
Status: StatusOK,
Message: "Town root is under version control",
}
}