diff --git a/cmd/entire/cli/config.go b/cmd/entire/cli/config.go index c2cdd8c70..97748f8e8 100644 --- a/cmd/entire/cli/config.go +++ b/cmd/entire/cli/config.go @@ -97,6 +97,18 @@ func GetAgentsWithHooksInstalled(ctx context.Context) []types.AgentName { return installed } +// InstalledAgentDisplayNames returns user-facing display names for agents with hooks installed. +func InstalledAgentDisplayNames(ctx context.Context) []string { + installedNames := GetAgentsWithHooksInstalled(ctx) + displayNames := make([]string, 0, len(installedNames)) + for _, name := range installedNames { + if ag, err := agent.Get(name); err == nil { + displayNames = append(displayNames, string(ag.Type())) + } + } + return displayNames +} + // JoinAgentNames joins agent names into a comma-separated string. func JoinAgentNames(names []types.AgentName) string { strs := make([]string, len(names)) diff --git a/cmd/entire/cli/setup.go b/cmd/entire/cli/setup.go index fabe43053..bd29eb5d9 100644 --- a/cmd/entire/cli/setup.go +++ b/cmd/entire/cli/setup.go @@ -697,14 +697,7 @@ func runEnableInteractive(ctx context.Context, w io.Writer, agents []agent.Agent // printEnabledStatus prints agents and a hint about `entire configure`. func printEnabledStatus(ctx context.Context, w io.Writer) { - installedNames := GetAgentsWithHooksInstalled(ctx) - if len(installedNames) > 0 { - displayNames := make([]string, 0, len(installedNames)) - for _, name := range installedNames { - if ag, agErr := agent.Get(name); agErr == nil { - displayNames = append(displayNames, string(ag.Type())) - } - } + if displayNames := InstalledAgentDisplayNames(ctx); len(displayNames) > 0 { fmt.Fprintf(w, "Agents: %s\n", strings.Join(displayNames, ", ")) } fmt.Fprintln(w, "\nTo add more agents, run `entire configure`.") diff --git a/cmd/entire/cli/status.go b/cmd/entire/cli/status.go index 080bd7af1..56875e059 100644 --- a/cmd/entire/cli/status.go +++ b/cmd/entire/cli/status.go @@ -157,6 +157,16 @@ func formatSettingsStatusShort(ctx context.Context, s *EntireSettings, sty statu } } + // Show enabled agents + if s.Enabled { + if displayNames := InstalledAgentDisplayNames(ctx); len(displayNames) > 0 { + b.WriteString("\n") + b.WriteString(sty.render(sty.dim, " Agents · ")) + + b.WriteString(strings.Join(displayNames, ", ")) + } + } + return b.String() } diff --git a/cmd/entire/cli/status_test.go b/cmd/entire/cli/status_test.go index b19006dac..4fd9d5148 100644 --- a/cmd/entire/cli/status_test.go +++ b/cmd/entire/cli/status_test.go @@ -1008,6 +1008,92 @@ func TestFormatSettingsStatusShort_Disabled(t *testing.T) { } } +func TestRunStatus_ShowsEnabledAgents(t *testing.T) { + setupTestRepo(t) + writeSettings(t, testSettingsEnabled) + writeClaudeHooksFixture(t) + + var stdout bytes.Buffer + if err := runStatus(context.Background(), &stdout, false); err != nil { + t.Fatalf("runStatus() error = %v", err) + } + + output := stdout.String() + if !strings.Contains(output, "Agents ·") { + t.Errorf("Expected 'Agents ·' in output, got: %s", output) + } + if !strings.Contains(output, "Claude Code") { + t.Errorf("Expected 'Claude Code' in output, got: %s", output) + } +} + +func TestRunStatus_EnabledNoAgentsHidesHooksLine(t *testing.T) { + setupTestRepo(t) + writeSettings(t, testSettingsEnabled) + // No agent hooks installed + + var stdout bytes.Buffer + if err := runStatus(context.Background(), &stdout, false); err != nil { + t.Fatalf("runStatus() error = %v", err) + } + + output := stdout.String() + if strings.Contains(output, "Agents ·") { + t.Errorf("Should not show hooks line when no agents installed, got: %s", output) + } +} + +func TestRunStatus_DetailedShowsEnabledAgents(t *testing.T) { + setupTestRepo(t) + writeSettings(t, testSettingsEnabled) + writeClaudeHooksFixture(t) + + var stdout bytes.Buffer + if err := runStatus(context.Background(), &stdout, true); err != nil { + t.Fatalf("runStatus() error = %v", err) + } + + output := stdout.String() + if !strings.Contains(output, "Agents ·") { + t.Errorf("Expected 'Agents ·' in detailed output, got: %s", output) + } + if !strings.Contains(output, "Claude Code") { + t.Errorf("Expected 'Claude Code' in detailed output, got: %s", output) + } +} + +func TestRunStatus_DetailedDisabledDoesNotShowAgents(t *testing.T) { + setupTestRepo(t) + writeSettings(t, testSettingsDisabled) + writeClaudeHooksFixture(t) + + var stdout bytes.Buffer + if err := runStatus(context.Background(), &stdout, true); err != nil { + t.Fatalf("runStatus() error = %v", err) + } + + output := stdout.String() + if strings.Contains(output, "Agents ·") { + t.Errorf("Disabled detailed status should not show agents, got: %s", output) + } +} + +func TestRunStatus_DisabledDoesNotShowAgents(t *testing.T) { + setupTestRepo(t) + writeSettings(t, testSettingsDisabled) + writeClaudeHooksFixture(t) + + var stdout bytes.Buffer + if err := runStatus(context.Background(), &stdout, false); err != nil { + t.Fatalf("runStatus() error = %v", err) + } + + output := stdout.String() + if strings.Contains(output, "Agents ·") { + t.Errorf("Disabled status should not show agents, got: %s", output) + } +} + func TestFormatSettingsStatus_Project(t *testing.T) { t.Parallel()