refactor(cli): split ordinary issue command families - #270
Conversation
Extract Read, Create, Development, and Mutations from the monolithic CLI.Commands into focused modules under CLI.Commands.Issues.*. Update CLI dispatch, profile_defaults_test, and split issue_commands_test.exs into per-family test files backed by a shared IssueCommandsHelpers support module. CLI.Commands retains only Move and Relations (EXT-54). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
state_map/4 is used by both "issue status" and "issue take with --status" describe blocks, so it must live at module level. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
profiles.ex moduledoc and profile_defaults_test describe strings still referenced LinearCli.CLI.Commands.issue_list/1, issue_update/1, and issue_develop/2 after those functions were extracted into the Issues.* modules in the previous commit.
Rework: address stale documentation referencesAddressed review feedback from the code review stage: What was changed:
Quality: 493 tests passing, credo clean, |
There was a problem hiding this comment.
🔵 Needs a closer look
The refactor spans dispatch, multiple command modules, build configuration, and broad test restructuring, warranting final human review.
Pull request overview
Refactors issue CLI commands into focused modules while preserving dispatch behavior and reorganizing tests.
Changes:
- Extracts read, create, development, and mutation command families.
- Updates CLI and profile command references.
- Splits tests and adds shared helpers.
File summaries
| File | Reviewed changes |
|---|---|
app/test/support/issue_commands_helpers.ex |
Adds shared test fixtures and helpers. |
app/test/linear_cli/cli/profile_defaults_test.exs |
Updates tests to use extracted modules. |
app/test/linear_cli/cli/commands/issues/read_test.exs |
Covers read commands. |
app/test/linear_cli/cli/commands/issues/mutations_test.exs |
Covers mutation commands. |
app/test/linear_cli/cli/commands/issues/development_test.exs |
Covers development commands. |
app/test/linear_cli/cli/commands/issues/create_test.exs |
Covers create commands. |
app/mix.exs |
Updates test support compilation. |
app/lib/linear_cli/profiles.ex |
Updates command references. |
app/lib/linear_cli/cli/commands/issues/read.ex |
Implements read commands. |
app/lib/linear_cli/cli/commands/issues/mutations.ex |
Implements mutation commands. |
app/lib/linear_cli/cli/commands/issues/development.ex |
Implements development commands. |
app/lib/linear_cli/cli/commands/issues/create.ex |
Implements create commands. |
app/lib/linear_cli/cli/commands.ex |
Retains move and relation commands. |
app/lib/linear_cli/cli.ex |
Dispatches commands to focused modules. |
Review details
- Files reviewed: 14/15 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
capture_io(:stderr, ...) redirects the global :standard_error device. With async: true, output from concurrent test modules' CLI invocations leaked into CLITest's capture windows, causing intermittent failures in the refute output =~ "What the heck is this?" assertion (line 559), and the HTTP 401 error from CLITest:402 leaked into issue_commands_test:1571. Fixes both flakes by making CLITest async: false (same pattern as missing_api_key_test.exs). Also adds profiles-db cleanup to setup so a stale active team from ProfilesTest/ProfileDefaultsTest doesn't cause project_update to call team(id: $id) instead of the viewer-based team resolution the stub expects.
Fix: CLITest async: false to stop stderr capture leakageRoot cause: Two failures addressed by one fix:
Fix: Changed Verification: 0/40 failures in stress test with |
Fix: CLITest async: false to stop stderr capture leakageCommit: fix(test): make CLITest async: false to stop stderr capture leakage What was fixedThe CI failure at The EXT-53 refactor split Changes in this commit
Verification
|
Summary
Read,Create,Development, andMutationscommand families from the monolithicLinearCli.CLI.Commandsinto focused modules underLinearCli.CLI.Commands.Issues.*(building block 6 of Phase 18)cli.exdispatch to call the new modules directly;commands.exretains only Move and Relations (to be extracted in EXT-54)issue_commands_test.exsinto four focused test files backed by a sharedIssueCommandsHelperssupport module; the original file retains only move and relation testsprofile_defaults_test.exsto call the new modules instead of the removedCommands.*functionsTest plan
mix precommitpasses (format, credo --strict, 493 tests all green)Read,Create,Development, andMutationscommand familiesissue_commands_test.exs(move + relations, 1594 lines) passes unchangedprofile_defaults_test.exsupdated to use new module aliasesCloses EXT-53
🤖 Generated with Claude Code