refactor(cli): extract move and relation commands into focused modules - #272
Conversation
Completes EXT-54 (phase 18): extracts `issue_move` and
`issue_relation_{list,add,remove}` from the monolithic
`LinearCli.CLI.Commands` module into `Issues.Move` and
`Issues.Relations`. Deletes the now-empty `commands.ex` and the
monolithic `issue_commands_test.exs`, replacing them with
`move_test.exs` and `relations_test.exs`. Updates `cli.ex` dispatch
aliases accordingly and updates the AGENTS.md module map.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Add relation route-level coverage and correct the inaccurate module-map documentation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Refactors issue move and relation CLI commands into focused modules, splitting tests and updating dispatch documentation.
Changes:
- Added dedicated
MoveandRelationscommand modules. - Updated CLI dispatch aliases.
- Replaced monolithic issue-command tests with focused suites.
- Updated the CLI module map.
File summaries
| File | Summary |
|---|---|
app/test/linear_cli/cli/issue_commands_test.exs |
Removed monolithic issue-command tests. |
app/test/linear_cli/cli/commands/issues/relations_test.exs |
Added focused relation command tests. |
app/test/linear_cli/cli/commands/issues/move_test.exs |
Added focused move command tests. |
app/lib/linear_cli/cli/commands/issues/relations.ex |
Extracted issue relation commands. |
app/lib/linear_cli/cli/commands/issues/move.ex |
Extracted issue move command. |
app/lib/linear_cli/cli.ex |
Updated command dispatch; relation routes need end-to-end smoke coverage. |
AGENTS.md |
Updated module map; corrections are needed for command ownership documentation. |
Review details
Suppressed comments (1)
AGENTS.md:88
- The updated module map says
Mutationscontains label commands, but this module's public commands are update, comment, status, and assign (app/lib/linear_cli/cli/commands/issues/mutations.ex:1-5,30,79,110,128). This omits the actualissue updatecommand and documents a nonexistent label subcommand; please correct the list.
CLI.Commands.Issues.Mutations — issue status/assign/label/comment subcommands
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
bougyman
left a comment
There was a problem hiding this comment.
Get rid of the regex and if then else, replace with matching function signatures.
…odule map, relation smoke tests - Replace UUID regex + if/else in resolve_bulk_project with two function clauses: binary pattern <<_::8*8, ?-, _::4*8, ...>> for UUID shape, plain name lookup otherwise - Replace if/else in show_move_results with two function clauses keyed on the "json" output mode - Remove false Ruby attribution from Move moduledoc - Fix AGENTS.md module map: split System into System/Profiles/Teams/Projects entries, correct Mutations description to update/status/assign/comment - Add route-level smoke tests for issue relation list/add/remove via LinearCli.CLI.main/1, covering the dispatch paths not exercised by the direct-module tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rework summaryAddressed all review comments from bougyman and Copilot. Changes madebougyman: move.ex:4 — false Ruby attribution bougyman: move.ex:130,165 — regex and if/then/else
Also replaced the Copilot: AGENTS.md:84 — incorrect module map
Fixed Copilot: cli.ex:250 — missing route-level coverage for relation dispatch Result496 tests pass (up from 493), format clean, credo clean. |
Rework summaryReview comments addressedbougyman — move.ex:4: Removed the inaccurate "Ported from vendor/ruby-linear-cli" moduledoc note; the move command was written fresh for this project. bougyman — move.ex:130 & 165: Replaced # UUID by structure: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
defp resolve_bulk_project(<<_::8*8, ?-, _::4*8, ?-, _::4*8, ?-, _::4*8, ?-, _::12*8>> = uuid, _team_fn) do
short_name = String.slice(uuid, 0, 8) <> "…"
{:ok, struct(LinearCli.Linear.Project, %{id: uuid, name: short_name})}
end
defp resolve_bulk_project(value, team_fn) do
# name/search lookup...
endAlso replaced the Copilot — cli.ex:250: Added a Copilot — AGENTS.md:84 & 88: Fixed the module map:
Result496 tests pass (3 new route smoke tests added), format clean, credo clean. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All requested changes addressed: regex replaced with binary pattern matching, false attributions removed, module map corrected, route smoke tests added.
Summary
issue_moveintoLinearCli.CLI.Commands.Issues.Moveand all four relation functions intoLinearCli.CLI.Commands.Issues.Relationscommands.exand the monolithicissue_commands_test.exsmove_test.exs(20 tests) andrelations_test.exs(38 tests), bothasync: truecli.exdispatch aliases; updates AGENTS.md module mapCloses EXT-54. Completes phase-18 of the CLI refactoring plan.
Test plan
mix test— 493 tests, 0 failuresmix format --check-formatted— cleanmix credo --strict— no issuesgit pushpre-push hooks pass (format + credo + test subset)alias LinearCli.CLI.Commandsreferences remain🤖 Generated with Claude Code