linear
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLinear GraphQL
Linear GraphQL
All Linear operations go through the client tool exposed by
Symphony's app server. It handles auth automatically.
linear_graphqljson
{
"query": "query or mutation document",
"variables": { "optional": "graphql variables" }
}One operation per tool call. A top-level array means the operation
failed even if the tool call completed.
errors所有Linear操作均通过Symphony应用服务器提供的客户端工具执行,它会自动处理身份验证。
linear_graphqljson
{
"query": "query or mutation document",
"variables": { "optional": "graphql variables" }
}每次工具调用对应一个操作。如果返回结果中包含顶层数组,即使工具调用完成,也表示操作失败。
errorsWorkpad
Workpad
Maintain a local in your workspace. Edit freely (zero API cost),
then sync to Linear at milestones — plan finalized, implementation done,
validation complete. Do not sync after every small change.
workpad.mdFirst sync — create the comment, save the ID:
graphql
mutation CreateComment($issueId: String!, $body: String!) {
commentCreate(input: { issueId: $issueId, body: $body }) {
success
comment { id }
}
}Write the returned to so subsequent syncs can update.
comment.id.workpad-idSubsequent syncs — read , update in place:
.workpad-idgraphql
mutation UpdateComment($id: String!, $body: String!) {
commentUpdate(id: $id, input: { body: $body }) { success }
}在你的工作区中维护本地的文件。可自由编辑(无API成本),并在关键节点(计划定稿、实现完成、验证通过)时同步到Linear。不要在每次小改动后都同步。
workpad.md首次同步 — 创建评论,保存ID:
graphql
mutation CreateComment($issueId: String!, $body: String!) {
commentCreate(input: { issueId: $issueId, body: $body }) {
success
comment { id }
}
}将返回的写入文件,以便后续同步时可以更新该评论。
comment.id.workpad-id后续同步 — 读取文件,原地更新:
.workpad-idgraphql
mutation UpdateComment($id: String!, $body: String!) {
commentUpdate(id: $id, input: { body: $body }) { success }
}Query an issue
查询问题
The orchestrator injects issue context (identifier, title, description, state,
labels, URL) into your prompt at startup. You usually do not need to re-read.
When you do, use the narrowest lookup for what you have:
graphql
undefined编排器会在启动时将问题上下文(标识符、标题、描述、状态、标签、URL)注入到你的提示词中。通常你无需重新查询。
当你确实需要查询时,根据已有的信息使用最精准的查询方式:
graphql
undefinedBy ticket key (e.g. MT-686)
By ticket key (e.g. MT-686)
query($key: String!) {
issue(id: $key) {
id identifier title url description
state { id name type }
project { id name }
}
}
For comments and attachments:
```graphql
query($id: String!) {
issue(id: $id) {
comments(first: 50) { nodes { id body user { name } createdAt } }
attachments(first: 20) { nodes { url title sourceType } }
}
}query($key: String!) {
issue(id: $key) {
id identifier title url description
state { id name type }
project { id name }
}
}
如需查询评论和附件:
```graphql
query($id: String!) {
issue(id: $id) {
comments(first: 50) { nodes { id body user { name } createdAt } }
attachments(first: 20) { nodes { url title sourceType } }
}
}State transitions
状态转换
Fetch team states first, then move with the exact :
stateIdgraphql
query($id: String!) {
issue(id: $id) {
team { states { nodes { id name } } }
}
}graphql
mutation($id: String!, $stateId: String!) {
issueUpdate(id: $id, input: { stateId: $stateId }) {
success
issue { state { name } }
}
}请先获取团队状态,再使用准确的进行状态转换:
stateIdgraphql
query($id: String!) {
issue(id: $id) {
team { states { nodes { id name } } }
}
}graphql
mutation($id: String!, $stateId: String!) {
issueUpdate(id: $id, input: { stateId: $stateId }) {
success
issue { state { name } }
}
}Attach a PR or URL
附加PR或URL
graphql
undefinedgraphql
undefinedGitHub PR (preferred for PRs)
GitHub PR (preferred for PRs)
mutation($issueId: String!, $url: String!, $title: String) {
attachmentLinkGitHubPR(issueId: $issueId, url: $url, title: $title, linkKind: links) {
success
}
}
mutation($issueId: String!, $url: String!, $title: String) {
attachmentLinkGitHubPR(issueId: $issueId, url: $url, title: $title, linkKind: links) {
success
}
}
Plain URL
Plain URL
mutation($issueId: String!, $url: String!, $title: String) {
attachmentLinkURL(issueId: $issueId, url: $url, title: $title) {
success
}
}
undefinedmutation($issueId: String!, $url: String!, $title: String) {
attachmentLinkURL(issueId: $issueId, url: $url, title: $title) {
success
}
}
undefinedFile upload
文件上传
Three steps:
- Get upload URL:
graphql
mutation($filename: String!, $contentType: String!, $size: Int!) {
fileUpload(filename: $filename, contentType: $contentType, size: $size, makePublic: true) {
success
uploadFile { uploadUrl assetUrl headers { key value } }
}
}- PUT file bytes to with the returned headers (use
uploadUrl).curl - Embed in comments/workpad as
assetUrl.
三个步骤:
- 获取上传URL:
graphql
mutation($filename: String!, $contentType: String!, $size: Int!) {
fileUpload(filename: $filename, contentType: $contentType, size: $size, makePublic: true) {
success
uploadFile { uploadUrl assetUrl headers { key value } }
}
}- 使用工具,将文件字节通过PUT请求上传到
curl,并携带返回的请求头。uploadUrl - 在评论或Workpad中使用的格式嵌入
。assetUrl
Issue creation
创建问题
Resolve project slug to IDs first:
graphql
query($slug: String!) {
projects(filter: { slugId: { eq: $slug } }) {
nodes { id teams { nodes { id key states { nodes { id name } } } } }
}
}Then create:
graphql
mutation($input: IssueCreateInput!) {
issueCreate(input: $input) {
success
issue { identifier url }
}
}$inputtitleteamIdprojectIddescriptionprioritystateIdgraphql
mutation($input: IssueRelationCreateInput!) {
issueRelationCreate(input: $input) { success }
}Input: , , ( or ).
issueIdrelatedIssueIdtypeblocksrelated先将项目slug解析为ID:
graphql
query($slug: String!) {
projects(filter: { slugId: { eq: $slug } }) {
nodes { id teams { nodes { id key states { nodes { id name } } } } }
}
}然后创建问题:
graphql
mutation($input: IssueCreateInput!) {
issueCreate(input: $input) {
success
issue { identifier url }
}
}$inputtitleteamIdprojectIddescriptionprioritystateIdgraphql
mutation($input: IssueRelationCreateInput!) {
issueRelationCreate(input: $input) { success }
}输入参数:、、(或)。
issueIdrelatedIssueIdtypeblocksrelatedRules
规则
- No introspection. Never use or
__typequeries. They return the entire Linear schema (~200K chars) and waste the context window. Every pattern you need is documented above.__schema - Keep queries narrowly scoped — ask only for fields you need.
- Sync the workpad at milestones, not after every change.
- For state transitions, always fetch team states first — never hardcode state IDs.
- Prefer over generic URL attachment for GitHub PRs.
attachmentLinkGitHubPR
- 禁止自省:绝不允许使用或
__type查询。这类查询会返回整个Linear架构(约200KB字符),浪费上下文窗口。你所需的所有使用模式均已在上述文档中说明。__schema - 保持查询范围精准——只请求你需要的字段。
- 仅在关键节点同步Workpad,而非每次改动后都同步。
- 进行状态转换时,务必先获取团队状态——绝不要硬编码状态ID。
- 对于GitHub PR,优先使用而非通用URL附加方式。
attachmentLinkGitHubPR