Skip to content

feat(issue): add --from/--to bulk project-to-project mode to lc issue move - #189

Merged
bougyman merged 2 commits into
mainfrom
EXT-10-issue-move
Aug 24, 2026
Merged

feat(issue): add --from/--to bulk project-to-project mode to lc issue move#189
bougyman merged 2 commits into
mainfrom
EXT-10-issue-move

Conversation

@bougyman

@bougyman bougyman commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Extends the existing lc issue move command (which moves explicit issue IDs via --project) with a second bulk project-to-project mode: lc issue move --from SOURCE --to TARGET.

  • Optimus spec updated with --from/--to/--all options alongside the existing --project/--team (single spec, two modes)
  • issue_move/1 dispatches on presence of --from/--to vs issue IDs — all existing ID-based behavior is unchanged
  • Bulk mode resolves both projects (UUID used directly; name searched within --team), guards against same-project moves, lists open issues from source (mine: false, all: flags.all), then fans out concurrent mutations (max 20, ordered, 30s timeout) following the issue_status/1 pattern
  • Per-issue "moved to" lines + summary count on completion; --output json emits an array of updated issue maps; --dry-run lists without mutating

Test plan

  • 7 new issue move --from/--to tests: happy path (3 mutations), --all (no date guards in filter), --dry-run (no mutations), error mid-batch (non-zero exit), --output json (decodable array of 3), UUID bypass (no $teamId query), same-ID guard (halts before list query)
  • All 333 existing tests still pass (ID-based mode unchanged)
  • mix ci passes (compile clean, credo no issues, usage_rules sync, 340/340 tests)

Closes EXT-10.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 24, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

… move

Extends the existing `issue move` subcommand (which moves explicit issue IDs
to a target project via --project) with a second mode for bulk project-level
transfer: `lc issue move --from Source --to Target`.

The bulk mode resolves both projects (UUID used directly; name searched within
the given --team), guards against same-project moves, lists all open issues
from the source (or all with --all), then fans out concurrent mutations via
Task.async_stream following the same pattern as issue_status/1. Per-issue
"moved to" lines are printed and a summary count is shown on completion.
With --output json the array of updated issue records is emitted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bougyman bougyman changed the title feat: lc issue move — bulk concurrent project move with JSON output feat(issue): add --from/--to bulk project-to-project mode to lc issue move Aug 24, 2026
Three issues from the code review, all in the bulk project-to-project mode:

1. Silent decline: user declining the confirmation prompt now prints
   "Move cancelled" (matching the ID-based mode's behaviour).

2. Partial --from/--to: passing only one of --from/--to now returns a
   clear error ("--from and --to must both be given for bulk mode")
   instead of silently falling through to ID mode with a confusing message.

3. UUID-as-name in output: resolving a project by UUID now creates a
   synthetic struct with a short label ("00000000…") rather than the
   full UUID string, keeping summary lines readable.

Three new tests cover the reworked behaviour: bulk decline prints
"Move cancelled", --from without --to exits 22 with a clear message,
--to without --from exits 22 with a clear message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bougyman

Copy link
Copy Markdown
Member Author

Rework summary (addressing code review feedback)

Three minor issues from the review have been addressed in commit a1a87e0:

1. Silent decline in bulk mode → fixed

When the user declines the --from/--to confirmation prompt, the code now prints "Move cancelled" (same as the ID-based mode). Previously it returned :ok silently.

File: app/lib/linear_cli/cli/commands.exmove_issues_by_project/2 cond branch.

2. Partial --from/--to → clear error

Passing only one of --from or --to now returns {:error, {:smells_bad, "--from and --to must both be given for bulk project-to-project mode"}} immediately, exiting with code 22 and a readable message. Previously it fell through to ID mode, producing confusing downstream errors.

File: app/lib/linear_cli/cli/commands.exissue_move/1 dispatch, converted if to cond with a third branch.

3. UUID-as-name in output → short label

resolve_bulk_project/2 now creates the synthetic project struct with name: "00000000…" (first 8 hex chars + ellipsis) instead of the full UUID string. Summary lines now read "Moved 3 issue(s) from 00000000… to 00000000…" rather than full UUIDs.

File: app/lib/linear_cli/cli/commands.exresolve_bulk_project/2.

Tests added

Three new tests in issue_commands_test.exs:

  • --from/--to user declines prints 'Move cancelled'
  • --from without --to exits 22 with a clear error
  • --to without --from exits 22 with a clear error

Quality suite: mix ci exits 0 — compile clean, format clean, credo clean, 343/343 tests (3 new).

Observations not acted on

  • IssueHelpers.move_issue/2 is intentionally not used by the concurrent paths (correct — tasks should not print during streaming).
  • Duplicate async_stream logic left as-is (small, not worth an abstraction at this scale).

@bougyman
bougyman merged commit bbb2df3 into main Aug 24, 2026
2 checks passed
@bougyman
bougyman deleted the EXT-10-issue-move branch August 24, 2026 18:22
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