From 1dbfc84e5fffd82dd9535981925614a0136795d2 Mon Sep 17 00:00:00 2001 From: Willie Date: Wed, 8 Apr 2026 22:19:20 +0800 Subject: [PATCH] fix: show [merge] mode in agent sub-items for status and doctor Agents always use merge mode (symlink-per-file). Add [merge] prefix to agent sub-item detail in status and doctor for consistency with skills. Also refactor doctor displayTargetStatus to use sub-item format (target name as header, skills/agents as indented sub-items). --- cmd/skillshare/doctor.go | 21 ++++++++++++--------- cmd/skillshare/doctor_agents.go | 18 +++++++++--------- cmd/skillshare/status.go | 2 +- cmd/skillshare/status_project.go | 2 +- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/cmd/skillshare/doctor.go b/cmd/skillshare/doctor.go index 602889d72..1dfb5dc7e 100644 --- a/cmd/skillshare/doctor.go +++ b/cmd/skillshare/doctor.go @@ -411,13 +411,16 @@ func checkTargets(cfg *config.Config, result *doctorResult, isProject bool) map[ targetIssues := checkTargetIssues(target, cfg.Source) + // Target name header + fmt.Printf("%s%s%s\n", ui.Bold, name, ui.Reset) + if len(targetIssues) > 0 { - ui.Error("%s [%s]: %s", name, mode, strings.Join(targetIssues, ", ")) + fmt.Printf(" skills %s[%s] %s%s\n", ui.Red, mode, strings.Join(targetIssues, ", "), ui.Reset) result.addError() details = append(details, fmt.Sprintf("%s: %s", name, strings.Join(targetIssues, ", "))) hasError = true } else { - cached := displayTargetStatus(name, target, cfg.Source, mode) + cached := displayTargetStatus(target, cfg.Source, mode) cache[name] = cached } @@ -480,7 +483,7 @@ func checkTargetIssues(target config.TargetConfig, source string) []string { return targetIssues } -func displayTargetStatus(name string, target config.TargetConfig, source, mode string) cachedTargetStatus { +func displayTargetStatus(target config.TargetConfig, source, mode string) cachedTargetStatus { sc := target.SkillsConfig() var statusStr string var cached cachedTargetStatus @@ -496,7 +499,7 @@ func displayTargetStatus(name string, target config.TargetConfig, source, mode s case sync.StatusMerged: statusStr = fmt.Sprintf("merged (%d shared, %d local)", linkedCount, localCount) case sync.StatusLinked: - statusStr = "linked (needs sync to apply merge mode)" + statusStr = "linked (needs sync)" needsSync = true default: statusStr = status.String() @@ -509,7 +512,7 @@ func displayTargetStatus(name string, target config.TargetConfig, source, mode s case sync.StatusCopied: statusStr = fmt.Sprintf("copied (%d managed, %d local)", managedCount, localCount) case sync.StatusLinked: - statusStr = "linked (needs sync to apply copy mode)" + statusStr = "linked (needs sync)" needsSync = true default: statusStr = status.String() @@ -519,16 +522,16 @@ func displayTargetStatus(name string, target config.TargetConfig, source, mode s cached.status = status statusStr = status.String() if status == sync.StatusMerged { - statusStr = "merged (needs sync to apply symlink mode)" + statusStr = "merged (needs sync)" needsSync = true } } + statusColor := ui.Green if needsSync { - ui.Warning("%s [%s]: %s", name, mode, statusStr) - } else { - ui.Success("%s [%s]: %s", name, mode, statusStr) + statusColor = ui.Yellow } + fmt.Printf(" skills %s[%s] %s%s\n", statusColor, mode, statusStr, ui.Reset) return cached } diff --git a/cmd/skillshare/doctor_agents.go b/cmd/skillshare/doctor_agents.go index fabcd88ec..1f42c1654 100644 --- a/cmd/skillshare/doctor_agents.go +++ b/cmd/skillshare/doctor_agents.go @@ -21,12 +21,12 @@ func checkAgentTargetInline(name string, target config.TargetConfig, builtinAgen info, err := os.Stat(agentPath) if err != nil { if os.IsNotExist(err) { - fmt.Printf(" agents %s%-12s%s %s\n", ui.Gray, "not created", ui.Reset, ui.Dim+agentPath+ui.Reset) + fmt.Printf(" agents %s[merge] not created%s\n", ui.Gray, ui.Reset) result.addCheck("agent_target_"+name, checkPass, fmt.Sprintf("Agent target %s: not created yet", name), nil) return } - fmt.Printf(" agents %s%-12s%s %s\n", ui.Red, "error", ui.Reset, ui.Dim+err.Error()+ui.Reset) + fmt.Printf(" agents %s[merge] error: %s%s\n", ui.Red, err.Error(), ui.Reset) result.addError() result.addCheck("agent_target_"+name, checkError, fmt.Sprintf("Agent target %s: %v", name, err), nil) @@ -34,7 +34,7 @@ func checkAgentTargetInline(name string, target config.TargetConfig, builtinAgen } if !info.IsDir() { - fmt.Printf(" agents %s%-12s%s %s\n", ui.Red, "error", ui.Reset, ui.Dim+"not a directory"+ui.Reset) + fmt.Printf(" agents %s[merge] error: not a directory%s\n", ui.Red, ui.Reset) result.addError() result.addCheck("agent_target_"+name, checkError, fmt.Sprintf("Agent target %s: path is not a directory", name), nil) @@ -43,8 +43,8 @@ func checkAgentTargetInline(name string, target config.TargetConfig, builtinAgen linked, broken := countAgentLinksAndBroken(agentPath) if broken > 0 { - msg := fmt.Sprintf("%d linked, %d broken", linked, broken) - fmt.Printf(" agents %s%-12s%s %s\n", ui.Yellow, "broken", ui.Reset, ui.Dim+msg+ui.Reset) + msg := fmt.Sprintf("[merge] %d linked, %d broken", linked, broken) + fmt.Printf(" agents %s%s%s\n", ui.Yellow, msg, ui.Reset) result.addWarning() result.addCheck("agent_target_"+name, checkWarning, fmt.Sprintf("Agent target %s: %s", name, msg), nil) @@ -52,16 +52,16 @@ func checkAgentTargetInline(name string, target config.TargetConfig, builtinAgen } if linked != agentCount && agentCount > 0 { - msg := fmt.Sprintf("%d/%d linked (drift)", linked, agentCount) - fmt.Printf(" agents %s%-12s%s %s\n", ui.Yellow, "drift", ui.Reset, ui.Dim+msg+ui.Reset) + msg := fmt.Sprintf("[merge] drift (%d/%d linked)", linked, agentCount) + fmt.Printf(" agents %s%s%s\n", ui.Yellow, msg, ui.Reset) result.addWarning() result.addCheck("agent_target_"+name, checkWarning, fmt.Sprintf("Agent target %s: drift (%d/%d agents linked)", name, linked, agentCount), nil) return } - msg := fmt.Sprintf("%d/%d linked", linked, agentCount) - fmt.Printf(" agents %s%-12s%s %s\n", ui.Green, "synced", ui.Reset, ui.Dim+msg+ui.Reset) + msg := fmt.Sprintf("[merge] synced (%d/%d linked)", linked, agentCount) + fmt.Printf(" agents %s%s%s\n", ui.Green, msg, ui.Reset) result.addCheck("agent_target_"+name, checkPass, fmt.Sprintf("Agent target %s: %d agents synced", name, linked), nil) } diff --git a/cmd/skillshare/status.go b/cmd/skillshare/status.go index 5acd49c34..596bfa5a4 100644 --- a/cmd/skillshare/status.go +++ b/cmd/skillshare/status.go @@ -420,7 +420,7 @@ func printTargetsStatus(cfg *config.Config, discovered []sync.DiscoveredSkill) e agentStatus = "drift" driftLabel = ui.Yellow + " (drift)" + ui.Reset } - printTargetSubItem("agents", agentStatus, fmt.Sprintf("%d/%d linked%s", linked, agentCount, driftLabel)) + printTargetSubItem("agents", agentStatus, fmt.Sprintf("[merge] %d/%d linked%s", linked, agentCount, driftLabel)) } } } diff --git a/cmd/skillshare/status_project.go b/cmd/skillshare/status_project.go index cbebc4f8e..9ccb56934 100644 --- a/cmd/skillshare/status_project.go +++ b/cmd/skillshare/status_project.go @@ -277,7 +277,7 @@ func printProjectTargetsStatus(runtime *projectRuntime, discovered []sync.Discov agentStatus = "drift" driftLabel = ui.Yellow + " (drift)" + ui.Reset } - printTargetSubItem("agents", agentStatus, fmt.Sprintf("%d/%d linked%s", linked, agentCount, driftLabel)) + printTargetSubItem("agents", agentStatus, fmt.Sprintf("[merge] %d/%d linked%s", linked, agentCount, driftLabel)) } } }