Support all six document attachment targets in document create/update/list/view - #262
Merged
Conversation
Refresh the vendored schema from live introspection. Notably picks up releaseId/cycleId on DocumentCreateInput/DocumentUpdateInput, the team/cycle/release relations on DocumentFilter, Document.cycle and Document.release, and ReleaseFilter — prerequisites for document attachment-target support.
Linear attaches every document to exactly one target — project, issue, initiative, team, cycle, or release — and documentCreate now rejects targetless documents outright. The CLI only exposed --project/--issue on create, --project on update, and slug-only --project plus --issue on list. The reporter asked for the missing create flags; the consistent fix is wider: a shared attachment-target module (six long-only flags, exactly-one validation before any network/editor/stdin work, --team + --cycle collapsing into one team-scoped cycle target like the issue commands) now backs create, update, and list, so their semantics cannot drift. Along the way this removes the interactive "workspace document" option (it always fails server-side now), gives update the missing --issue, fixes list --project silently matching slug IDs only, resolves list filters to IDs so bad input errors instead of returning an empty list, types the ATTACHMENT column (six namespaces make bare names ambiguous), and shows all six associations in view/list output. New shared resolvers: resolveInitiativeId (UUID/slug/name) and resolveReleaseId (UUID/name/version, paginated to exhaustion so ambiguity detection sees every candidate, erroring on ambiguous matches rather than picking one silently). teamId/initiativeId/cycleId are [Internal] in Linear's schema but verified working with a regular API key, as issueId was before it became public. Live-QA'd against a real workspace for project/issue/team/cycle/ initiative targets, including re-pointing (the server clears the old target). Releases require a Business plan and are covered by mocked tests and the refreshed schema only. Github-Issue: Fixes #260 Github-Issue-Url: #260
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.
Linear attaches every document to exactly one target — project, issue, initiative, team, cycle, or release — and
documentCreatenow rejects targetless documents outright. The CLI only exposed--project/--issueon create,--projecton update, and slug-only--projectplus--issueon list.This goes beyond the literal report (create flags) to make attachment support consistent everywhere, per the six-target model:
attachment-targetmodule backingcreate,update, andlist: six long-only flags, client-side exactly-one validation before any network/editor/stdin work (errors name CLI flags, not GraphQL fields), and--team+--cyclecollapsing into one team-scoped cycle target, matching the issue commands.creategains--initiative,--team,--cycle,--release; the interactive "Nothing (workspace document)" option is removed (it always fails server-side now) and the prompt offers all six targets.updategains all target flags including the previously missing--issue; a target flag re-points the document (the server clears the old target).listgains the same filters, resolved to relation IDs — this also fixes--projectsilently matching slug IDs only, and makes invalid filter input error instead of returning an empty list. The ATTACHMENT column now labels the target type (Team: Linear CLI (CLI),Cycle: CLI #2 — Polish sprint, …).viewselects and renders all six associations;--jsonoutput keeps GraphQL field names/nesting.resolveInitiativeId(UUID/slug/name) andresolveReleaseId(UUID/name/version, paginated to exhaustion) — both reject ambiguous matches with a candidate listing instead of picking one silently.sync-schemarefresh: the vendored schema predatedreleaseId/cycleIdon the document inputs,ReleaseFilter, andDocument.cycle/Document.release.Notes:
teamId/initiativeId/cycleIdare marked[Internal]in Linear's schema but verified working with a regular API key (asissueIdwas before it became public); failures would surface cleanly through the existing error handling.Fixes #260