Skip to content

refactor(cli): extract issue identifier and workflow-state helpers - #265

Merged
bougyman merged 1 commit into
mainfrom
EXT-48-extract-issue-identifier-workflow-state-helpers
Sep 11, 2026
Merged

bougyman merged 1 commit into
mainfrom
EXT-48-extract-issue-identifier-workflow-state-helpers

Conversation

@ruby-automation

Copy link
Copy Markdown
Contributor

Summary

  • Extracts LinearCli.CLI.Issue.Identifiers from IssueHelpers: single public function expand_issue_id/1 with private team-resolution helpers (profile → favorites → prompt).
  • Extracts LinearCli.CLI.Issue.WorkflowStates from IssueHelpers: cancelled_state_for/2, completed_state_for/2, and resolve_workflow_state/2 (made public to avoid duplicating exact+prefix matching logic between type-filtered selection and gimme_da_issue!'s --status resolution).
  • IssueHelpers delegates to both new modules; Commands aliases Identifiers directly for its 12 expand_issue_id call sites.
  • smells_bad/1 one-liner duplicated in WorkflowStates; removed from IssueHelpers (its callers there use inline tuples).

Test plan

  • expand_issue_id_test.exs updated to call Identifiers.expand_issue_id/1 directly
  • New test/linear_cli/cli/issue/workflow_states_test.exs: moved cancelled/completed_state_for tests + 5 new targeted tests for resolve_workflow_state/2 (exact match, case-insensitive, unique prefix, unknown name, ambiguous prefix)
  • issue_helpers_test.exs: pruned moved tests; cancel_issue, close_issue, gimme_da_issue! tests still exercise workflow state selection end-to-end
  • 493 tests pass (was 484 — net +9 new tests)
  • mix compile --warnings-as-errors clean
  • mix credo --strict clean
  • mix format --check-formatted clean

Phase 18, EXT-48.

🤖 Generated with Claude Code

Move bare-ID expansion into `LinearCli.CLI.Issue.Identifiers` and
workflow-state selection/matching into `LinearCli.CLI.Issue.WorkflowStates`.

- `Identifiers.expand_issue_id/1` consolidates the bare-number-to-prefixed-ID
  expansion and its team-resolution helpers (profile → favorites → prompt).
- `WorkflowStates.cancelled_state_for/2`, `completed_state_for/2` consolidate
  type-filtered state selection with prompt-or-direct return.
- `WorkflowStates.resolve_workflow_state/2` is made public so
  `IssueHelpers.gimme_da_issue!/2` can use the same exact+prefix matching
  logic without duplication.
- `IssueHelpers` delegates to both new modules; `Commands` aliases
  `Identifiers` directly for its twelve `expand_issue_id` call sites.
- Tests split: `expand_issue_id_test.exs` updated to call `Identifiers`;
  `workflow_states_test.exs` added with moved + new targeted tests for
  `resolve_workflow_state/2`; `issue_helpers_test.exs` pruned of the
  `cancelled/completed_state_for` describe block.

Phase 18, EXT-48.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bougyman
bougyman merged commit fe2199b into main Sep 11, 2026
3 checks passed
@bougyman
bougyman deleted the EXT-48-extract-issue-identifier-workflow-state-helpers branch September 11, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants