feat(skills): resolve --label and --assignee names in Linear create/update-issue - #29099
Closed
zhang-liz wants to merge 1 commit into
Closed
feat(skills): resolve --label and --assignee names in Linear create/update-issue#29099zhang-liz wants to merge 1 commit into
zhang-liz wants to merge 1 commit into
Conversation
…pdate-issue
The Linear CLI's create-issue handler ignored its declared `--label` and
`--assignee` flags, with a `TODO: label + assignee name->id lookup (omitted
for v1 brevity)` comment at linear_api.py:232 acknowledging the gap. update-
issue didn't expose the flags at all. Users had to hand-pluck Linear UUIDs.
This change adds two resolver helpers that mirror the existing
`_resolve_team_id` shape and the state-name lookup already used by
update-status (lines 261-284):
- `_resolve_label_ids(team_id, names)` — labels are team-scoped, queried via
`team(id) { labels { ... } }`. Case-insensitive, comma-separated names
accepted at the CLI surface.
- `_resolve_user_id(name_or_email)` — matches against `name`, `displayName`,
or `email` from the workspace `users` query. Case-insensitive. Tolerates
null `displayName`/`email` (Linear sometimes returns these).
Both `create-issue` and `update-issue` now wire these in. `update-issue`
fetches the issue's team id first (one extra query) so label resolution stays
correctly team-scoped. The SKILL.md Python-helper section documents the new
human-readable flag usage.
Tests: `tests/skills/test_linear_skill.py` — 17 cases covering single/multi/
case-insensitive resolution, not-found exit semantics, null-field tolerance,
both command wirings, the `update-issue --title only` fast path that must skip
the team lookup, and `--label ',Bug,,'` empty-segment parsing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
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.
What does this PR do?
Implements the in-source TODO at
skills/productivity/linear/scripts/linear_api.py:232:# TODO: label + assignee name->id lookup (omitted for v1 brevity)create-issuealready declared--labeland--assigneeargparse flags, but the handler dropped them on the floor — users had to fetch Linear UUIDs by hand.update-issuedidn't expose the flags at all. After this PR both subcommands accept human-readable names and resolve them to UUIDs server-side, mirroring the existing_resolve_team_id(line 116) and the state-name lookup incmd_update_status(lines 261–284).Related Issue
No tracking issue — closes an in-source TODO.
Type of Change
Changes Made
skills/productivity/linear/scripts/linear_api.py_resolve_label_ids(team_id, names)— labels are team-scoped in Linear, so the query isteam(id) { labels(first: 100) { nodes { id name } } }. Case-insensitive match. On miss: stderr +sys.exit(1)(matches thecmd_update_statusprecedent at line 273)._resolve_user_id(name_or_email)— matches againstname,displayName, oremailfrom the workspaceusersquery. Case-insensitive. Tolerates nulldisplayName/email.cmd_create_issue: replaces the TODO; parses--label "Bug,P1"into a list, calls the resolvers, setslabelIdsandassigneeIdin the mutation input. Empty segments (",Bug,,") are ignored.cmd_update_issue: adds the same fields. Because labels are team-scoped, when either flag is set we issue one extraissue(id) { team { id } }query first to recover the team id, then resolve.--title-only updates still take the existing one-query fast path.--labeland--assigneeadded to theupdate-issueparser; help text updated on both subcommands.skills/productivity/linear/SKILL.md— short Quick Reference block under the "Python helper script" section showing the new flag usage. (The hand-writtencurlexamples already documentedlabelIds/assigneeIdin raw form, so no change there.)tests/skills/test_linear_skill.py— new. 17 stdlib-only tests usingmonkeypatchonlinear_api.gql. Covers single/multi/case-insensitive label resolution, not-found exit semantics, null-field tolerance, both command wirings end-to-end,update-issue --title only(must skip the team lookup), empty-segment parsing, andupdate-issuewith a non-existent issue identifier.How to Test
Checklist
Code
pytest tests/skills/test_linear_skill.py -v -o addopts=""→ 17 passed)Documentation & Housekeeping
SKILL.mdQuick Reference + module docstring)cli-config.yaml.example— N/A (no config keys added)CONTRIBUTING.md/AGENTS.md— N/A (no architecture change)scripts/check-windows-footguns.pyclean.