Skip to content

feat(skills): resolve --label and --assignee names in Linear create/update-issue - #29099

Closed
zhang-liz wants to merge 1 commit into
NousResearch:mainfrom
zhang-liz:feat/linear-name-resolution
Closed

feat(skills): resolve --label and --assignee names in Linear create/update-issue#29099
zhang-liz wants to merge 1 commit into
NousResearch:mainfrom
zhang-liz:feat/linear-name-resolution

Conversation

@zhang-liz

Copy link
Copy Markdown

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-issue already declared --label and --assignee argparse flags, but the handler dropped them on the floor — users had to fetch Linear UUIDs by hand. update-issue didn'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 in cmd_update_status (lines 261–284).

Related Issue

No tracking issue — closes an in-source TODO.

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

  • skills/productivity/linear/scripts/linear_api.py
    • New _resolve_label_ids(team_id, names) — labels are team-scoped in Linear, so the query is team(id) { labels(first: 100) { nodes { id name } } }. Case-insensitive match. On miss: stderr + sys.exit(1) (matches the cmd_update_status precedent at line 273).
    • New _resolve_user_id(name_or_email) — matches against name, displayName, or email from the workspace users query. Case-insensitive. Tolerates null displayName/email.
    • cmd_create_issue: replaces the TODO; parses --label "Bug,P1" into a list, calls the resolvers, sets labelIds and assigneeId in 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 extra issue(id) { team { id } } query first to recover the team id, then resolve. --title-only updates still take the existing one-query fast path.
    • Argparse: --label and --assignee added to the update-issue parser; help text updated on both subcommands.
    • Module docstring updated to document the new flag semantics.
  • skills/productivity/linear/SKILL.md — short Quick Reference block under the "Python helper script" section showing the new flag usage. (The hand-written curl examples already documented labelIds/assigneeId in raw form, so no change there.)
  • tests/skills/test_linear_skill.pynew. 17 stdlib-only tests using monkeypatch on linear_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, and update-issue with a non-existent issue identifier.

How to Test

# Fresh checkout of the branch, then:
pytest tests/skills/test_linear_skill.py -v -o addopts=""
# → 17 passed

# Lint and Windows-safety:
ruff check skills/productivity/linear/scripts/linear_api.py tests/skills/test_linear_skill.py
# → All checks passed!
python3 scripts/check-windows-footguns.py skills/productivity/linear/scripts/linear_api.py tests/skills/test_linear_skill.py
# → ✓ No Windows footguns found

# CLI smoke (no API call needed):
python3 skills/productivity/linear/scripts/linear_api.py create-issue --help
python3 skills/productivity/linear/scripts/linear_api.py update-issue --help
# Both render the new --label / --assignee flags with help text.

# End-to-end (requires LINEAR_API_KEY):
python3 skills/productivity/linear/scripts/linear_api.py create-issue \
  --team ENG --title "smoke" --label "Bug,P1" --assignee "Alice Smith"

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature
  • I've run the new tests and they pass (pytest tests/skills/test_linear_skill.py -v -o addopts="" → 17 passed)
  • I've added tests for my changes
  • I've tested on my platform: macOS 15 (Darwin 25.3.0)

Documentation & Housekeeping

  • I've updated relevant documentation (SKILL.md Quick Reference + module docstring)
  • cli-config.yaml.example — N/A (no config keys added)
  • CONTRIBUTING.md / AGENTS.md — N/A (no architecture change)
  • Cross-platform impact considered: pure GraphQL + argparse, no process/file/term/Windows-sensitive calls. scripts/check-windows-footguns.py clean.

…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>
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have tool/skills Skills system (list, view, manage) labels May 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #21143 — same feature (label and assignee name→ID resolution for Linear skill). Two prior PRs (#28628, #27213) were already closed as duplicates of #21143. Please consolidate there.

@zhang-liz

Copy link
Copy Markdown
Author

Thanks for the catch — closing as duplicate of #21143. I searched the open bugs and existing PRs but missed the canonical feature ticket. Will consolidate via #21143 if it gets reopened for contributions; otherwise standing down. Apologies for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have tool/skills Skills system (list, view, manage) type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants