Files
gastown/internal/doctor/commands_check.go
jack 29058f321c refactor(commands): provision slash commands at town-level only (gt-7x274)
- gt install now creates ~/gt/.claude/commands/ with all commands
- Removed per-workspace provisioning from crew/polecat managers
- Updated bd doctor to check town-level instead of per-workspace
- All agents inherit via Claude directory traversal

This eliminates duplicate /handoff skills in the picker.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 15:49:53 -08:00

76 lines
2.0 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",
},
},
}
}
// 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)
}