Skip to content

Commit 988d978

Browse files
bougymanclaude
andauthored
feat: add st and stat aliases for issue status (CRY-50) (#128)
## Summary - Adds `"st"` and `"stat"` to the `"issue"` entry in `@subcommand_aliases` in `LinearCli.CLI`, alongside the existing `"s"` alias - All three aliases resolve to canonical `"status"` before Optimus ever parses argv, so `lc i st`, `lc i stat`, and `lc issue status` behave identically - No existing aliases, flags, or command behavior changed ## Test plan - [ ] `normalize_subcommand_aliases/1` unit assertions for both `["i", "st", ...]` and `["i", "stat", ...]` in `cli_test.exs` - [ ] End-to-end dispatch tests for `"issue", "st"` and `"issue", "stat"` in `issue_commands_test.exs`, each verifying a full status-change flow through `main/1` with a stubbed API - [ ] All 48 tests in the two affected test files pass; 5 pre-existing `GitTest` failures (environmental, unrelated to this change) confirmed unchanged before and after Closes [CRY-50](https://linear.app/cryptokairos/issue/CRY-50/add-st-and-stat-aliases-for-issue-status) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8629443 commit 988d978

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

app/lib/linear_cli/cli.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ defmodule LinearCli.CLI do
101101
"l" => "list",
102102
"ls" => "list",
103103
"s" => "status",
104+
"st" => "status",
105+
"stat" => "status",
104106
"u" => "update",
105107
"pull-request" => "pr"
106108
},

app/test/linear_cli/cli/issue_commands_test.exs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,72 @@ defmodule LinearCli.CLI.IssueCommandsTest do
880880

881881
assert_received :updated
882882
end
883+
884+
test "alias 'st' routes to issue status" do
885+
test_pid = self()
886+
887+
Req.Test.stub(LinearCli.Api, fn conn ->
888+
{:ok, body, conn} = Plug.Conn.read_body(conn)
889+
%{"query" => query} = Jason.decode!(body)
890+
891+
cond do
892+
String.contains?(query, "issue(id: $id)") ->
893+
Req.Test.json(conn, %{"data" => %{"issue" => issue_map()}})
894+
895+
String.contains?(query, "states {") ->
896+
Req.Test.json(conn, states_response())
897+
898+
String.contains?(query, "issueUpdate") ->
899+
send(test_pid, :updated)
900+
901+
Req.Test.json(conn, %{
902+
"data" => %{"issueUpdate" => %{"issue" => issue_with_state("s3", "Done")}}
903+
})
904+
905+
true ->
906+
raise "no stub matched query: #{query}"
907+
end
908+
end)
909+
910+
capture_io(fn ->
911+
assert :ok = LinearCli.CLI.main(["issue", "st", "--status", "Done", "CRY-1"])
912+
end)
913+
914+
assert_received :updated
915+
end
916+
917+
test "alias 'stat' routes to issue status" do
918+
test_pid = self()
919+
920+
Req.Test.stub(LinearCli.Api, fn conn ->
921+
{:ok, body, conn} = Plug.Conn.read_body(conn)
922+
%{"query" => query} = Jason.decode!(body)
923+
924+
cond do
925+
String.contains?(query, "issue(id: $id)") ->
926+
Req.Test.json(conn, %{"data" => %{"issue" => issue_map()}})
927+
928+
String.contains?(query, "states {") ->
929+
Req.Test.json(conn, states_response())
930+
931+
String.contains?(query, "issueUpdate") ->
932+
send(test_pid, :updated)
933+
934+
Req.Test.json(conn, %{
935+
"data" => %{"issueUpdate" => %{"issue" => issue_with_state("s3", "Done")}}
936+
})
937+
938+
true ->
939+
raise "no stub matched query: #{query}"
940+
end
941+
end)
942+
943+
capture_io(fn ->
944+
assert :ok = LinearCli.CLI.main(["issue", "stat", "--status", "Done", "CRY-1"])
945+
end)
946+
947+
assert_received :updated
948+
end
883949
end
884950

885951
describe "issue update (Ruby: commands/issue/update.rb)" do

app/test/linear_cli/cli_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ defmodule LinearCli.CLITest do
282282
assert LinearCli.CLI.normalize_subcommand_aliases(["i", "pull-request", "CRY-1"]) ==
283283
["issue", "pr", "CRY-1"]
284284

285+
assert LinearCli.CLI.normalize_subcommand_aliases(["i", "st", "CRY-1"]) ==
286+
["issue", "status", "CRY-1"]
287+
288+
assert LinearCli.CLI.normalize_subcommand_aliases(["i", "stat", "CRY-1"]) ==
289+
["issue", "status", "CRY-1"]
290+
285291
# `take` has no alias in Ruby either - unaliased subcommands pass through.
286292
assert LinearCli.CLI.normalize_subcommand_aliases(["issue", "take", "CRY-1"]) ==
287293
["issue", "take", "CRY-1"]

0 commit comments

Comments
 (0)