Skip to content

feat(issue-list): add -i/--include-labels flag and fix --labels parser hole - #259

Merged
ruby-automation merged 2 commits into
mainfrom
EXT-45-include-labels-issue-list-cli-contract
Sep 7, 2026
Merged

feat(issue-list): add -i/--include-labels flag and fix --labels parser hole#259
ruby-automation merged 2 commits into
mainfrom
EXT-45-include-labels-issue-list-cli-contract

Conversation

@ruby-automation

Copy link
Copy Markdown
Contributor

Summary

  • Add -i/--include-labels boolean flag to issue list that controls label display independently of the -l/--labels NAME filter
  • Fix a silent parser hole where --labels --all consumed --all as a label name instead of erroring; now exits non-zero with a clear usage message before any API request
  • Decouple label-field GraphQL selection from label-filter logic throughout the stack (cli.ex → commands.ex → issue.ex)

Changes

  • app/lib/linear_cli/cli.ex: add include_labels flag (-i/--include-labels); harden parse_labels/1 to reject --prefixed tokens
  • app/lib/linear_cli/cli/commands.ex: derive include_labels = flag || label_filter != []; pass to both domain input and Display.show/2
  • app/lib/linear_cli/linear/issue.ex: add include_labels: :boolean argument to :list action; use args.include_labels || args.labels != [] for GraphQL document selection
  • documents/ash-domain-erd.adoc: document new argument and its semantics

Test plan

  • --include-labels / -i short flag requests label fields and shows them in compact output
  • -N --include-labels --all sends no assignee/date filter, no label filter, requests label fields
  • --labels --all exits non-zero with a clear usage error and sends no API request
  • -s/--status composes with --include-labels
  • Positional issue identifier with --include-labels uses full lookup and renders labels
  • --output json --include-labels includes fetched label objects in stdout
  • Domain-level include_labels: true with no label filter selects label fields without adding a label filter
  • include_labels: false with no label filter does NOT include label fields in the query
  • All 482 tests pass (format + credo strict + full test suite)

Closes EXT-45

🤖 Generated with Claude Code

…r hole

Add an explicit boolean -i/--include-labels flag to issue list that
controls label display independently of the existing -l/--labels filter.

Close the motivating parser hole: parse_labels/1 now rejects any value
token that starts with '-', so --labels --all exits with a clear usage
error (Optimus exit 1) before any GraphQL request instead of silently
treating --all as a label name.

Separate the label-field selection concern from the label-filter concern
throughout the stack:
- cli.ex: add include_labels flag; harden parse_labels/1
- commands.ex: derive include_labels = flag || label_filter != [];
  pass it as both domain input and Display option
- issue.ex: add include_labels: boolean argument to :list action;
  use (args.include_labels || args.labels != []) for document selection
- ash-domain-erd.adoc: document the new argument and its semantics

Add tests covering: --include-labels/-i, -N --include-labels --all,
--labels --all parse error, -s/--status composition, positional ID
with --include-labels, --output json --include-labels, and domain-level
include_labels field selection behaviour.

Closes EXT-45
…rse_labels

Use two `parse_labels_result/2` clauses instead of a case expression,
per idiomatic Elixir style for dispatching on nil vs. a value.
@ruby-automation

Copy link
Copy Markdown
Contributor Author

Rework: replaced non-idiomatic case with pattern-matched function heads

Per review feedback on the parse_labels implementation at cli.ex:491:

Replaced the case Enum.find(...) block dispatching on nil vs. a value with two parse_labels_result/2 function clauses — one matching nil (valid input), one matching any other term (bad token). The logic is unchanged; only the form is idiomatic.

Quality gate: 482 tests pass, credo --strict clean, format clean.

@ruby-automation
ruby-automation merged commit 7dd4bd0 into main Sep 7, 2026
3 checks passed
@ruby-automation
ruby-automation deleted the EXT-45-include-labels-issue-list-cli-contract branch September 7, 2026 15:00
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.

1 participant