Skip to content

Accept team names and IDs, and state names, wherever the CLI takes them - #279

Merged
schpetbot merged 1 commit into
mainfrom
schpet/team-and-state-resolvers
Sep 5, 2026
Merged

Accept team names and IDs, and state names, wherever the CLI takes them#279
schpetbot merged 1 commit into
mainfrom
schpet/team-and-state-resolvers

Conversation

@schpetbot

@schpetbot schpetbot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

First of a three-PR stack (this → #280#281), informed by a comparison with Linear's MCP server.

Every command that takes a team now accepts its key, name, or UUID through one shared resolver (findTeam / resolveTeam / resolveTeams), replacing the key-only getTeamIdByKey and the ad-hoc uppercasing spread across commands. One aliased ResolveTeam operation looks up key, name, and (for UUID-shaped input) id in a single round trip; precedence is key, then id, then name, so a reference that equals one team's key and another team's name always means the key. An unknown team errors with the list of valid keys instead of an empty result or a raw API error.

issue query --state and issue mine --state also take a workflow state name or ID in addition to the six type tokens, resolved within the queried scope so a state from another team errors instead of silently matching nothing.

Only explicit input goes through the resolver; the configured default team key is already normalized and skips the extra round trip.

Verified: 676 tests (64 old GetTeamIdByKey mocks rewritten, new unit and command tests), live checks by name, lowercase key, and UUID, a QA case table of 18 cases, and four Codex review passes (two real findings fixed: a --web path resolving outside the error handler, and a non-advancing pagination cursor).

https://claude.ai/code/session_01A9qEGri4p2HZMQSuYsBmub

Every command that takes a team now accepts its key, name, or UUID through
one shared resolver (findTeam / resolveTeam / resolveTeams), replacing the
key-only getTeamIdByKey and the ad-hoc uppercasing spread across commands.
One aliased ResolveTeam operation looks up key, name, and (for UUID-shaped
input) id in a single round trip; precedence is key, then id, then name,
applied client-side so a reference that equals one team's key and another
team's name always means the key. Keys stay the canonical downstream form:
filters that matched on team.key still do, with the server's uppercase key,
and callers that need a UUID take it from the same resolved object. An
unknown team now errors with the list of valid keys instead of an empty
result or a raw "Entity not found" from the API.

Only explicit input goes through the resolver. The configured default team
is already a normalized key, and resolving it would add a round trip to
every default-team invocation of the most-used commands for no gain. In
issue create, the interactive substring picker survives only for that
default; an explicit --team that matches nothing errors like everywhere
else.

issue query --state and issue mine --state take a workflow state name or
ID as well as the six type tokens. Names and IDs are resolved within the
queried scope (the team, the teams, or the whole workspace under
--all-teams, where a name matches every team's same-named state), so a
state from another team errors instead of silently matching nothing, and
the error lists the scope's states. Type-only input still sends the same
{ type: { in } } filter with no extra request; a mix of types and names
becomes an or-filter.

The MCP server already describes these parameters as "key, name, or ID"
and "type, name, or ID"; this brings the CLI to parity so an agent does
not need a preliminary team list to translate a name into a key.

Claude-Session: https://claude.ai/code/session_01A9qEGri4p2HZMQSuYsBmub
@schpetbot
schpetbot merged commit 3a00cc7 into main Sep 5, 2026
15 checks passed
@schpetbot
schpetbot deleted the schpet/team-and-state-resolvers branch September 5, 2026 14:19
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.

2 participants