feat(field): read and write custom fields with per-type value coercion - #44
Open
timimsms wants to merge 1 commit into
Open
feat(field): read and write custom fields with per-type value coercion#44timimsms wants to merge 1 commit into
timimsms wants to merge 1 commit into
Conversation
Implements the GetCustomFields and SetCustomFieldValue methods that internal/interfaces/api.go has declared since the interface was written, and adds the `cu field` command over them: list, get, set, clear. Values are coerced to the shape each type expects rather than passed through as strings — epoch milliseconds for dates, resolved option ids for dropdowns and labels — so `cu field set <task> Machine "Chilastra,Sunrunner"` works with names. Unknown option names are rejected with the valid set; unsupported types (formula, rollup, progress) refuse rather than guess, since a silently wrong write is worse than a clear error. Fields are resolved from the task's own list, so space- and folder-level fields resolve without the caller knowing where they were defined. An ambiguous field name is an error rather than a first match. Addresses PROJECT_SPEC §13 open question 1. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aqbmccWm1tqttmBUCR5rv ClickUp: 86dxbeqyt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements custom field read/write and adds a
cu fieldcommand over it.GetCustomFieldsandSetCustomFieldValuehave been declared ininternal/interfaces/api.gosince the interface was written, with no implementation behind them. This adds those (plusRemoveCustomFieldValue) onapi.Clientand exposes:Values are coerced per type rather than passed through as strings, which is the substance of the change — ClickUp expects epoch milliseconds for dates, option UUIDs for dropdowns, and an array of option UUIDs for labels. So names work on the command line:
Dates accept
today,now,2006-01-02, RFC3339, or epoch milliseconds.Design choices worth reviewing:
formula,rollup,manual_progressand friends returnsetting fields of type "manual_progress" is not supported— a silently wrong write is worse than a clear error.Addresses PROJECT_SPEC §13 open question 1 ("Support ClickUp Custom Fields in JSON output?") — all four output formats share one row shape, so
-o jsongives{name, type, id, value}.Tests
TestFindCustomField,TestCoerceCustomFieldValue,TestFormatCustomFieldValuecover every supported type, both resolution directions (name→id on write, id→name on read), and each rejection path. Set/get/clear round-trips were also exercised live against a real workspace.Checklist
./scripts/ci.shpasses locally — excepterrcheck, which reports the same 27 pre-existing findings onmain, none in files this PR touchescu docs markdown --dir docs/site/commands) and added to the mkdocs nav