Skip to content

feat(task): add task archive - #49

Merged
timimsms merged 3 commits into
mainfrom
feat/task-archive
Nov 15, 2026
Merged

timimsms merged 3 commits into
mainfrom
feat/task-archive

Conversation

@timimsms

@timimsms timimsms commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds cu task archive, which had no equivalent in the CLI.

$ cu task archive 86e312u87
✓ Archived task 86e312u87: …
$ cu task archive 86e312u87 --undo
✓ Unarchived task 86e312u87: …

Why archive rather than close or delete. Archiving removes a task from active views while keeping its history and its URL. For retiring a task whose work has moved elsewhere, that is the only correct primitive: closing asserts a status the task never actually reached — and after #45 we know "closed"/"complete" is not even a status name on every list — while deleting destroys the record and breaks any link to it.

Implementation note worth a look: the SDK cannot express this. clickup.TaskUpdateRequest has no archived field, so UpdateTask can never send it. The request is built directly against the SDK's exported NewRequest/Do, which is the same path its own services use, rather than adding a second HTTP client.

Verification

Round-tripped against a real workspace on a throwaway task: archived goes false → true → false, and the task's URL and status are intact afterwards. The task was deleted after the test.

Checklist

  • ./scripts/ci.sh passes locally — except errcheck, which reports the same 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) and added to the mkdocs nav
  • Docs updated if user-facing behavior changed — README example

Review fixes

  • Tests: internal/api/archive_test.go runs SetTaskArchived against an httptest.Server. It checks the method (PUT), the path (/task/<id>), the body ({"archived":true}, and false for --undo), that a 404 returns an error, and that the ID is path-escaped. internal/cmd/task_test.go checks that task archive is registered and has a --undo bool flag.
  • Error UX: task archive sets SilenceUsage, so an API failure no longer prints the usage block. Errors are now wrapped as failed to archive task: … (or unarchive with --undo). The root command is unchanged.
  • Path escaping: the task ID goes through url.PathEscape when the request path is built.
  • Flag comment: --undo is registered under its own // Archive command flags comment.

The generated CLI docs only changed their timestamps, so they are not included.

🤖 Generated with Claude Code

timimsms and others added 3 commits November 15, 2026 11:26
Archiving removes a task from active views while keeping its history and URL,
which is the right primitive for retiring a task whose work has moved
elsewhere. Closing it would assert a status the task never reached — and
"closed" is not a status name on every list — while deleting destroys the
record.

The SDK cannot express this: clickup.TaskUpdateRequest has no archived field,
so the request is built directly against the exported NewRequest/Do.

Reversible with --undo; round-trip verified against a real workspace, with the
task URL and status intact afterwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aqbmccWm1tqttmBUCR5rv
ClickUp: 86dxbeqyt
Escape the task ID with url.PathEscape when building the archive path.
Set SilenceUsage on task archive so API failures no longer print the
usage block, and wrap errors as "failed to archive/unarchive task".
Give the --undo flag its own comment block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timimsms
timimsms merged commit d035f74 into main Nov 15, 2026
16 checks passed
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