Skip to content

fix(task): resolve close/reopen statuses from the list instead of hardcoding - #45

Open
timimsms wants to merge 1 commit into
mainfrom
fix/close-status-resolution
Open

fix(task): resolve close/reopen statuses from the list instead of hardcoding#45
timimsms wants to merge 1 commit into
mainfrom
fix/close-status-resolution

Conversation

@timimsms

Copy link
Copy Markdown
Owner

Summary

Fixes #32. task close sent the literal status "complete" and task reopen sent "open". Those names only exist on lists using ClickUp's default status set — against any custom set the API rejects the update:

$ cu task close 86e2y09rd
Failed to close task: PUT https://api.clickup.com/api/v2/task/86e2y09rd: 400 Status does not exist ITEM_114

That list's statuses are backlog → scoping → in design → in development → in review → testing → ready for development → shipped → cancelled. Nothing is called "complete", so close was simply unusable there.

Both commands now resolve the status from the task's own list by status type rather than namedone (falling back to closed) for close, and the first open status in board order for reopen:

$ cu task close 86e2y09rd
✓ Closed task 86e2y09rd: …
$ cu task view 86e2y09rd | grep Status
Status: shipped
$ cu task reopen 86e2y09rd
  New status: backlog

--status overrides on both, for lists with more than one done status.

Bulk close resolves per task rather than once, since a bulk close can span lists with different status sets, and caches per list so one list still costs one lookup. A task whose list has no done status fails that task and continues, rather than aborting the batch.

Adds Client.GetList, which the SDK supported but the client did not expose.

Tests

TestClosedStatus / TestOpenStatus cover a real custom set (done wins over closed), the default set, tie-breaking by orderindex among several done statuses, and the error path naming the available statuses. Verified live against a list with a custom status set — the failing command above is from main, the passing ones from this branch.

Checklist

  • ./scripts/ci.sh passes locally — except errcheck, which reports the same 27 pre-existing findings on main, none in files this PR touches
  • Commit messages use conventional prefixes
  • CLI docs regenerated (cu docs markdown --dir docs/site/commands) — new --status flags on close/bulk close
  • Docs updated if user-facing behavior changed

…dcoding

`task close` sent status "complete" and `task reopen` sent "open". Those names
only exist on lists using ClickUp's default status set; against any custom set
the API rejects the update with "Status does not exist". Reproduced on a list
whose done status is "shipped".

Both now resolve the status from the task's own list by status *type* — done
(falling back to closed) for close, the first open status in board order for
reopen — and accept --status to override when a list has several. Bulk close
resolves per task, since a bulk close can span lists with different sets, and
caches per list so one list costs one lookup.

Fixes #32

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aqbmccWm1tqttmBUCR5rv
ClickUp: 86dxbeqyt
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.

task/bulk close: hardcoded status 'complete' fails on lists with differently named done status

1 participant