Skip to content

Add --add-label and --remove-label to issue update - #259

Merged
schpetbot merged 1 commit into
mainfrom
schpet/push-rtmkyzltxtnl
Aug 5, 2026
Merged

Add --add-label and --remove-label to issue update#259
schpetbot merged 1 commit into
mainfrom
schpet/push-rtmkyzltxtnl

Conversation

@schpetbot

@schpetbot schpetbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Adds per-issue incremental label operations to linear issue update, mapped onto the API's addedLabelIds/removedLabelIds in a single atomic mutation (no read-modify-write):

linear issue update ENG-123 --add-label security             # add, keep existing labels
linear issue update ENG-123 --remove-label sprint-42         # detach; does not delete the label
linear issue update ENG-123 --remove-label sprint-42 --add-label sprint-43  # atomic swap

This intentionally goes beyond the reported ask. The issue assumed --label was additive; it actually replaces the entire label set, so adding one label clobbered the rest — --add-label fixes that side too. --label keeps its documented replace semantics for existing scripts, with help text that now says so explicitly. Flag names match gh issue edit.

A --clear-labels flag was considered (an empty label set is currently inexpressible in one command) and deliberately deferred: adding a flag later is backwards compatible, removing a released one is breaking, and nothing has asked for clear-all yet.

Invalid combinations error before any network call: --label with incremental flags, the same resolved label ID in both add and remove (case-insensitive), and explicit --team moves combined with incremental flags (label names resolve against the destination team, which would make source-team labels silently unresolvable).

Notes from live QA against a scratch issue: add preserves existing labels, remove detaches per-issue while the label survives team-wide, and removing a label the issue doesn't have is rejected by Linear's API ("Label is not on issue ") — surfaced as-is rather than papered over.

Deferred as follow-ups: --clear-labels, label rename (team-wide; doesn't solve per-issue detach), and the same replace-only asymmetry on project labels/members/teams, subscribers, and attachment removal.

Fixes #258

The reporter asked for a way to detach a label from one issue without
deleting it team-wide, believing --label was additive. It actually
replaces the issue's entire label set (IssueUpdateInput.labelIds), so
the gap was wider than reported: adding one label clobbered the rest.
Rather than only the suggested --remove-label, this maps both
--add-label and --remove-label onto the API's addedLabelIds/
removedLabelIds (one atomic mutation, no read-modify-write). --label
keeps its documented replace semantics for existing scripts, with help
text that now says so. Flag names match gh issue edit, the surface
users and agents reach for first.

A --clear-labels flag was considered (an empty label set is currently
inexpressible in one command) and deliberately deferred: adding a flag
later is backwards compatible, removing one is breaking, and nothing
has asked for clear-all yet.

Invalid combinations error before any network call: --label with
incremental flags, the same resolved label ID in both add and remove,
and --team moves combined with incremental flags (label names resolve
against the destination team, which would make source-team labels
silently unresolvable). Live QA confirmed removing an unattached label
is rejected by Linear's API ("Label <id> is not on issue <id>"), not a
silent no-op — surfaced as-is, consistent with the repo's
explicit-input-errors philosophy.

The reporter's alternative ask (label rename) is deferred: it is
team-wide and would not solve the per-issue detach workflow.

Github-Issue: Fixes #258
Github-Issue-Url: #258
@schpetbot
schpetbot force-pushed the schpet/push-rtmkyzltxtnl branch from 044a1ff to 8eae8f1 Compare August 5, 2026 21:53
@schpetbot schpetbot changed the title Add --add-label, --remove-label, and --clear-labels to issue update Add --add-label and --remove-label to issue update Aug 5, 2026
@schpetbot
schpetbot merged commit 5214ca9 into main Aug 5, 2026
15 checks passed
@schpetbot
schpetbot deleted the schpet/push-rtmkyzltxtnl branch August 5, 2026 21:59
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.

Ability to remove/rename a label on an issue via issue update

2 participants