linear
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLinear GraphQL
Linear GraphQL
Use this skill for raw Linear GraphQL work during Symphony app-server sessions.
在Symphony应用服务器会话期间,使用此技能执行原生Linear GraphQL相关工作。
Primary tool
核心工具
Use the client tool exposed by Symphony's app-server session.
It reuses Symphony's configured Linear auth for the session.
linear_graphqlTool input:
json
{
"query": "query or mutation document",
"variables": {
"optional": "graphql variables object"
}
}Tool behavior:
- Send one GraphQL operation per tool call.
- Treat a top-level array as a failed GraphQL operation even if the tool call itself completed.
errors - Keep queries/mutations narrowly scoped; ask only for the fields you need.
使用Symphony应用服务器会话提供的客户端工具,它会复用当前会话中Symphony已配置的Linear认证信息。
linear_graphql工具输入:
json
{
"query": "query or mutation document",
"variables": {
"optional": "graphql variables object"
}
}工具行为:
- 每次工具调用仅发送一个GraphQL操作。
- 即便工具调用本身执行完成,若返回结果中存在顶层数组,也视为GraphQL操作失败。
errors - 保持查询/mutation的作用域尽可能窄,仅请求你需要的字段。
Discovering unfamiliar operations
查找不熟悉的操作
When you need an unfamiliar mutation, input type, or object field, use targeted
introspection through .
linear_graphqlList mutation names:
graphql
query ListMutations {
__type(name: "Mutation") {
fields {
name
}
}
}Inspect a specific input object:
graphql
query CommentCreateInputShape {
__type(name: "CommentCreateInput") {
inputFields {
name
type {
kind
name
ofType {
kind
name
}
}
}
}
}当你需要使用不熟悉的mutation、输入类型或对象字段时,可通过执行定向introspection查询。
linear_graphql列出所有mutation名称:
graphql
query ListMutations {
__type(name: "Mutation") {
fields {
name
}
}
}查看指定输入对象的结构:
graphql
query CommentCreateInputShape {
__type(name: "CommentCreateInput") {
inputFields {
name
type {
kind
name
ofType {
kind
name
}
}
}
}
}Common workflows
常用工作流
Query an issue by key, identifier, or id
按key、标识符或id查询issue
Use these progressively:
- Start with when you have a ticket key such as
issue(id: $key).MT-686 - Fall back to when you need identifier search semantics.
issues(filter: ...) - Once you have the internal issue id, prefer for narrower reads.
issue(id: $id)
Lookup by issue key:
graphql
query IssueByKey($key: String!) {
issue(id: $key) {
id
identifier
title
state {
id
name
type
}
project {
id
name
}
branchName
url
description
updatedAt
links {
nodes {
id
url
title
}
}
}
}Lookup by identifier filter:
graphql
query IssueByIdentifier($identifier: String!) {
issues(filter: { identifier: { eq: $identifier } }, first: 1) {
nodes {
id
identifier
title
state {
id
name
type
}
project {
id
name
}
branchName
url
description
updatedAt
}
}
}Resolve a key to an internal id:
graphql
query IssueByIdOrKey($id: String!) {
issue(id: $id) {
id
identifier
title
}
}Read the issue once the internal id is known:
graphql
query IssueDetails($id: String!) {
issue(id: $id) {
id
identifier
title
url
description
state {
id
name
type
}
project {
id
name
}
attachments {
nodes {
id
title
url
sourceType
}
}
}
}按以下优先级依次使用:
- 如果你有工单key(例如),优先使用
MT-686查询。issue(id: $key) - 如果你需要按标识符语义搜索,可回退使用。
issues(filter: ...) - 拿到issue的内部id后,优先使用执行更精准的查询。
issue(id: $id)
按issue key查询:
graphql
query IssueByKey($key: String!) {
issue(id: $key) {
id
identifier
title
state {
id
name
type
}
project {
id
name
}
branchName
url
description
updatedAt
links {
nodes {
id
url
title
}
}
}
}按标识符过滤查询:
graphql
query IssueByIdentifier($identifier: String!) {
issues(filter: { identifier: { eq: $identifier } }, first: 1) {
nodes {
id
identifier
title
state {
id
name
type
}
project {
id
name
}
branchName
url
description
updatedAt
}
}
}将key转换为内部id:
graphql
query IssueByIdOrKey($id: String!) {
issue(id: $id) {
id
identifier
title
}
}已知内部id时查询issue详情:
graphql
query IssueDetails($id: String!) {
issue(id: $id) {
id
identifier
title
url
description
state {
id
name
type
}
project {
id
name
}
attachments {
nodes {
id
title
url
sourceType
}
}
}
}Query team workflow states for an issue
查询issue所属团队的工作流状态
Use this before changing issue state when you need the exact :
stateIdgraphql
query IssueTeamStates($id: String!) {
issue(id: $id) {
id
team {
id
key
name
states {
nodes {
id
name
type
}
}
}
}
}在变更issue状态需要获取准确的时,可先执行此查询:
stateIdgraphql
query IssueTeamStates($id: String!) {
issue(id: $id) {
id
team {
id
key
name
states {
nodes {
id
name
type
}
}
}
}
}Edit an existing comment
编辑已有评论
Use through :
commentUpdatelinear_graphqlgraphql
mutation UpdateComment($id: String!, $body: String!) {
commentUpdate(id: $id, input: { body: $body }) {
success
comment {
id
body
}
}
}通过使用:
linear_graphqlcommentUpdategraphql
mutation UpdateComment($id: String!, $body: String!) {
commentUpdate(id: $id, input: { body: $body }) {
success
comment {
id
body
}
}
}Create a comment
新建评论
Use through :
commentCreatelinear_graphqlgraphql
mutation CreateComment($issueId: String!, $body: String!) {
commentCreate(input: { issueId: $issueId, body: $body }) {
success
comment {
id
url
}
}
}通过使用:
linear_graphqlcommentCreategraphql
mutation CreateComment($issueId: String!, $body: String!) {
commentCreate(input: { issueId: $issueId, body: $body }) {
success
comment {
id
url
}
}
}Move an issue to a different state
移动issue到其他状态
Use with the destination :
issueUpdatestateIdgraphql
mutation MoveIssueToState($id: String!, $stateId: String!) {
issueUpdate(id: $id, input: { stateId: $stateId }) {
success
issue {
id
identifier
state {
id
name
}
}
}
}使用并传入目标:
issueUpdatestateIdgraphql
mutation MoveIssueToState($id: String!, $stateId: String!) {
issueUpdate(id: $id, input: { stateId: $stateId }) {
success
issue {
id
identifier
state {
id
name
}
}
}
}Attach a GitHub PR to an issue
为issue关联GitHub PR
Use the GitHub-specific attachment mutation when linking a PR:
graphql
mutation AttachGitHubPR($issueId: String!, $url: String!, $title: String) {
attachmentLinkGitHubPR(
issueId: $issueId
url: $url
title: $title
linkKind: links
) {
success
attachment {
id
title
url
}
}
}If you only need a plain URL attachment and do not care about GitHub-specific
link metadata, use:
graphql
mutation AttachURL($issueId: String!, $url: String!, $title: String) {
attachmentLinkURL(issueId: $issueId, url: $url, title: $title) {
success
attachment {
id
title
url
}
}
}关联PR时请使用GitHub专属的attachment mutation:
graphql
mutation AttachGitHubPR($issueId: String!, $url: String!, $title: String) {
attachmentLinkGitHubPR(
issueId: $issueId
url: $url
title: $title
linkKind: links
) {
success
attachment {
id
title
url
}
}
}如果你只需要普通的URL附件,不需要GitHub专属的链接元数据,可使用:
graphql
mutation AttachURL($issueId: String!, $url: String!, $title: String) {
attachmentLinkURL(issueId: $issueId, url: $url, title: $title) {
success
attachment {
id
title
url
}
}
}Introspection patterns used during schema discovery
schema查找时使用的introspection模式
Use these when the exact field or mutation shape is unclear:
graphql
query QueryFields {
__type(name: "Query") {
fields {
name
}
}
}graphql
query IssueFieldArgs {
__type(name: "Query") {
fields {
name
args {
name
type {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}当不确定字段或mutation的准确结构时使用:
graphql
query QueryFields {
__type(name: "Query") {
fields {
name
}
}
}graphql
query IssueFieldArgs {
__type(name: "Query") {
fields {
name
args {
name
type {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}Upload a video to a comment
上传视频到评论
Do this in three steps:
- Call with
linear_graphqlto getfileUpload,uploadUrl, and any required upload headers.assetUrl - Upload the local file bytes to with
uploadUrland the exact headers returned bycurl -X PUT.fileUpload - Call again with
linear_graphql(orcommentCreate) and include the resultingcommentUpdatein the comment body.assetUrl
Useful mutations:
graphql
mutation FileUpload(
$filename: String!
$contentType: String!
$size: Int!
$makePublic: Boolean
) {
fileUpload(
filename: $filename
contentType: $contentType
size: $size
makePublic: $makePublic
) {
success
uploadFile {
uploadUrl
assetUrl
headers {
key
value
}
}
}
}分三步执行:
- 调用的
linear_graphql接口获取fileUpload、uploadUrl以及所有需要的上传请求头。assetUrl - 使用命令,携带
curl -X PUT返回的所有请求头,将本地文件字节上传到fileUpload。uploadUrl - 再次调用的
linear_graphql(或commentCreate)接口,将获取到的commentUpdate加入评论内容中。assetUrl
常用mutation:
graphql
mutation FileUpload(
$filename: String!
$contentType: String!
$size: Int!
$makePublic: Boolean
) {
fileUpload(
filename: $filename
contentType: $contentType
size: $size
makePublic: $makePublic
) {
success
uploadFile {
uploadUrl
assetUrl
headers {
key
value
}
}
}
}Usage rules
使用规则
- Use for comment edits, uploads, and ad-hoc Linear API queries.
linear_graphql - Prefer the narrowest issue lookup that matches what you already know: key -> identifier search -> internal id.
- For state transitions, fetch team states first and use the exact instead of hardcoding names inside mutations.
stateId - Prefer over a generic URL attachment when linking a GitHub PR to a Linear issue.
attachmentLinkGitHubPR - Do not introduce new raw-token shell helpers for GraphQL access.
- If you need shell work for uploads, only use it for signed upload URLs
returned by ; those URLs already carry the needed authorization.
fileUpload
- 评论编辑、上传操作以及临时的Linear API查询请使用。
linear_graphql - 优先使用与你已知信息最匹配的最精准issue查找方式:key -> 标识符搜索 -> 内部id。
- 进行状态流转时,请先获取团队状态列表,使用准确的,不要在mutation中硬编码状态名称。
stateId - 将GitHub PR关联到Linear issue时,优先使用,不要使用通用URL附件。
attachmentLinkGitHubPR - 不要新增使用裸token的shell工具来访问GraphQL。
- 如果需要使用shell执行上传操作,仅对返回的签名上传URL使用shell,这些URL已经携带了所需的授权信息。
fileUpload