Core workflow
Every API-backed command follows the same observable sequence.
- Resolve configuration.
cmd.Executeinitializes Viper. The client chooses--api-key, thenLINEAR_API_KEY, then~/.config/linear-cli/config.yaml. - Validate local input. Cobra validates positional arity. Commands validate required flags such as
--title,--team,--issue, or--fileand return exit code2for usage failures. - Resolve human identifiers. Issue mutations and comment/attachment operations turn an identifier such as
ENG-123into a UUID. Team-scoped label and state names are resolved in the same way. - Send GraphQL. The client posts JSON to
https://api.linear.app/graphqlwithAuthorization,Content-Type, and alinear-cli/<version>user agent. The request timeout is 30 seconds. - Map the result. HTTP and GraphQL errors become typed CLI errors. Successful data is wrapped by
output.PrintSuccess. - Hand off the result. JSON is printed to standard output and
mainexits with the corresponding code.
Successful list operations may include pagination.hasNextPage and pagination.endCursor. Error responses contain success: false and an error object; they do not contain data.
If a later attachment step fails, the command returns an error and has no cleanup operation for an already-uploaded asset. See limitations.