Repository navigation
fix(codegen): GraphQL operations are tagged by the entity they act on - #726
Merged
Merged
Conversation
A GraphQL CLI's agent skill had two API pages, query and mutation; Linear's mutation page is 336 commands and 4,335 lines, so an agent that wanted to archive an issue read all of it. adaptGraphql now gives each operation two tags: first the entity its field name acts on (the earliest, then longest, run of its words that names an object type with an id, last word read singular; never a mutation's whole name), then query or mutation as before. apiSkillFiles files one page per first tag, so `<cli> skill show api-issue` is the page to read. Commands, their names and permission keys do not change; `api list tag:mutation` still works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A page per leading verb (rate, verify, track) told an agent nothing and moved whenever a type was added; the few leftovers share the query or mutation page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leemour
added a commit
to WireCatLabs/cli-core
that referenced
this pull request
Nov 25, 2026
## Task
`linear live api issue-delete --id "" --yes --json` sent the request. It
answered exit 14 `outcome.unknown` ("Linear did not confirm a write"). A
required argument that is empty must be refused locally before any
request, with exit 2 `input.invalid`, naming the flag. OpenAPI CLIs must
behave the same.
## What
- `generatedApiCommand` refuses a required path, query or header
parameter that is empty or only spaces, before anything is sent. It
answers `validation_error`, which is exit 2 with reason `input.invalid`,
and the details say `sent: false`. On OpenAPI an empty path segment
could reach another endpoint (`/posts/`).
- `graphqlVariables` treats a blank required variable as missing, from a
flag or from `--body`. This covers the command and `serviceApiWriter`.
- `serviceApiWriter` refuses a blank required path, query or header
parameter from code too.
- A bot API body field (rpc) is still sent when it is empty. Telegram
documents `setWebhook --url ""` as the way to remove a webhook, and
tg-cli marks `url` as required. The review found this.
- A missing required field inside an input object was already refused by
the generated request schema. I checked this on linear: `issue-create
--input '{}'` gives exit 2 and names `input.teamId`.
- Changelog fragment: `changes/fix-api-empty-required.md`.
## Testing
- New tests:
- GraphQL: `--id ""`, `--id " "` and `--body '{"id":""}'` each give exit
2 and name `--id`, and nothing is sent.
- OpenAPI: a path parameter is refused by the command and by the writer.
- Bot: a required query parameter is refused, and an empty rpc body
field still goes through.
- I checked that the GraphQL and OpenAPI tests fail without the fix.
- `src/cli/service-api*`, `src/cli/bot` and `src/parity` pass. `pnpm
ci:quick`, `pnpm lint` and `pnpm docs:check` pass.
- I built linear-cli `release/1.0` against a local pack in a temp
worktree with throwaway config folders and no sign-in. `linear live api
issue-delete --id "" --yes --json` now prints
`{"error":{"code":"validation_error","reason":"input.invalid","message":"issue-delete
needs --id","details":{"sent":false}}}` with exit 2.
The companion cli-base PR is WireCatLabs/cli-base#726 (api skill groups
by entity).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Task
linear-cli's agent skill split the API into two pages:
mutation(336 commands, 4,335 lines) andquery(157). An agent that wanted to archive an issue had to read the whole mutation page. GraphQL operations should be grouped by the entity they act on, as OpenAPI CLIs group by tag, without renaming any command.What
adaptGraphqlgives each operation two tags: first the entity its field name acts on, thenqueryormutationas before.id. The last word is also read singular. Examples:issueLabels→issue-label,searchIssues→issue.projectUpdatemutation changes aProject, whileProjectUpdateis a status post type.rateLimitStatus,logout) keepsqueryormutation, so the few leftovers share one page.apiSkillFilesalready files one page per first tag, so nothing changed there.api list tag:mutationstill works.names.groups: "tags"would now mount GraphQL commands by entity. No GraphQL CLI uses it (linear and the kit seed usefromPath).changes/fix-api-entity-groups.md.Testing
src/codegentests pass (184), including a new test of the tags (a snake_case name, and a mutation named like an entity).pnpm ci:quick,pnpm lintandpnpm docs:checkpass.release/1.0, in a temp worktree, local packs through a pnpm override, not committed). Before: 2 groups. After: 70 groups, 493 commands in total. Some of them:api-issue.mdis 352 lines, down from 4,335 forapi-mutation.md. The old pages are pruned becausewriteArtifactsownsreferences/api/.The companion cli-core PR refuses empty required arguments.
🤖 Generated with Claude Code