diff --git a/internal/cli/run.go b/internal/cli/run.go index 8c1a74c..9db8678 100644 --- a/internal/cli/run.go +++ b/internal/cli/run.go @@ -161,9 +161,9 @@ func Run(args []string, out, errOut io.Writer) int { } cmd, rest := args[0], args[1:] role := commandRole(args) - switch cmd { + switch normalizeVerb(cmd) { case "list", "get", "search", "ack": - return runAgent(cmd, rest, role, out, errOut) + return runAgent(normalizeVerb(cmd), rest, role, out, errOut) case "send": return runSend(rest, role, out, errOut) case "account": diff --git a/internal/cli/run_test.go b/internal/cli/run_test.go index 7479aba..edc34a1 100644 --- a/internal/cli/run_test.go +++ b/internal/cli/run_test.go @@ -81,3 +81,13 @@ func b64AgentKey() string { // 32 bytes of 0x01, base64 — distinct from b64Key so slot mix-ups surface. return "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=" } + +func TestTopLevelLsAlias(t *testing.T) { + adminEnv(t) + // `ls` with no --account must hit the same usage path as `list` (CodeUsage + // envelope on stdout, exit 2) — proving it routed to the agent list command. + code, out, _ := run(t, "ls") + if code != 2 || !strings.Contains(out, "account") { + t.Fatalf("ls should alias list (usage about --account): code=%d out=%q", code, out) + } +}