Compare commits

...

1 Commits

Author SHA1 Message Date
J
d3c5ac648c fix(cli): show real MEMBERS count in multica squad list
The MEMBERS column was hardcoded to "-" in the table output, so every
squad looked empty even though the backend already returns
`member_count` (and `member_preview`) on each row. `squad get --output
json` exposed the correct data, which is why the bug was cosmetic but
confusing.

Read `member_count` from the response and render it; fall back to "-"
when missing or zero so empty squads stay visually distinct.

Fixes #3304 (MUL-2706).

Co-authored-by: multica-agent <github@multica.ai>
2026-05-26 19:56:08 +08:00

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strconv"
"text/tabwriter"
"time"
@@ -52,12 +53,25 @@ func runSquadList(cmd *cobra.Command, _ []string) error {
w := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0)
fmt.Fprintln(w, "ID\tNAME\tLEADER ID\tMEMBERS")
for _, s := range squads {
fmt.Fprintf(w, "%s\t%s\t%s\t-\n",
strVal(s, "id"), strVal(s, "name"), strVal(s, "leader_id"))
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n",
strVal(s, "id"), strVal(s, "name"), strVal(s, "leader_id"),
memberCountDisplay(s))
}
return w.Flush()
}
func memberCountDisplay(m map[string]any) string {
v, ok := m["member_count"]
if !ok || v == nil {
return "-"
}
n, ok := v.(float64)
if !ok || n <= 0 {
return "-"
}
return strconv.Itoa(int(n))
}
// ── Get ─────────────────────────────────────────────────────────────────────
var squadGetCmd = &cobra.Command{