关于 linear-cli
linear-cli 是用于在命令行中操作 Linear 问题及相关工作区数据的工具。它支持查询、搜索、创建和更新问题,并可通过 GraphQL 处理 CLI 不便完成的操作。
主要功能
- 01查看问题描述、评论和元数据
- 02列出并搜索问题
- 03交互式或通过命令创建问题
- 04更新问题状态并添加评论
- 05通过 CLI 调用 Linear GraphQL
适用场景
- 01开始处理前阅读问题需求
- 02按状态、负责人、团队或文本查找任务
- 03在任务处理中创建和更新问题
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ editframe/ skills --skill linear-cli安装后在 Claude Code 中输入/linear-cli确认已加载。
详细介绍
Linear CLI
通过命令行与 Linear 问题跟踪器交互。主要使用场景包括:
- 根据问题启动任务 —— 按 ID 获取问题、阅读其描述并开始工作
- 搜索/列出问题 —— 按状态、经办人、团队或全文搜索查找问题
- 查看问题详情 —— 阅读完整描述、评论和元数据
- 更新问题状态 —— 将问题标记为已开始,并添加进度评论
设置
安装
brew install schpet/tap/linear
身份验证
- 在 https://linear.app/settings/account/security 创建 API 密钥(需要成员权限,访客除外)
- 运行
linear auth login,并在提示时粘贴密钥 - 验证:
linear auth whoami
为此仓库配置
linear config
这会在仓库根目录中写入 .linear.toml,其中包含团队 ID 和工作区 slug。此文件会提交到 git,以便所有 Agent 和开发者共用相同配置。
根据问题启动任务
收到问题 ID(例如 ENG-123)时:
# Read the full issue -- description, state, assignee, labels, comments
linear issue view ENG-123
# Get just the title (useful for branch names or commit messages)
linear issue title ENG-123
# Get the Linear URL
linear issue url ENG-123
Agent 应先阅读问题描述以了解需求,然后再开始实现。
任务生命周期
开始时:开始实现后立即将问题移至「进行中」。
linear issue update ENG-123 -s started
# or via GraphQL if CLI fails (see Updating Issues below)
部署到生产环境时:只有在部署完全完成且更改已在生产环境上线后,才能将状态移至「审核中」。切勿推测 Linear 状态或在推送后立即更新——打开问题的审核者会访问生产站点,因此站点必须已反映此次更改。
必须按以下顺序操作:
- 推送到 telecine main(或合并 PR)
- 在
scripts/wait-for-telecine-action上等待,直到部署作业成功完成 - 只有此时才能将状态移至「审核中」并添加评论
# From monorepo/ — MUST complete before touching Linear
scripts/wait-for-telecine-action
# Then move to In Review
linear api <<'GRAPHQL'
mutation {
issueUpdate(id: "EF2-123", input: { stateId: "2717b5fe-9ea0-429f-8edd-cf8eabe0551d" }) { success }
}
GRAPHQL
linear issue comment add EF2-123 -b "Deployed to production. <one-line summary of what changed>"
评论应为一个句子,描述已实现或修复的内容,而不是提交列表。
搜索和列出问题
# List unstarted issues assigned to you (default)
# --sort is required: manual or priority (NOT "updated")
linear issue list --sort priority
# List issues in a specific state
linear issue list -s started --sort priority
linear issue list -s backlog --sort priority
linear issue list --all-states --sort priority
# List issues for all assignees
linear issue list -A --sort priority
# List unassigned issues
linear issue list -U --sort priority
# Filter by project -- requires exact name match; use GraphQL if not found
linear issue list --project "Project Name" --sort priority --team ENG
# Filter by team (required if no .linear.toml in repo)
linear issue list --team ENG --sort priority
# Limit results
linear issue list --limit 10 --sort priority
通过 GraphQL 列出项目中的问题(浏览项目时首选)
CLI 的 --project 筛选器不稳定(要求名称完全匹配,且需要指定团队)。请改用 GraphQL:
# First find the project ID
linear api <<'GRAPHQL'
query {
projects(first: 50) {
nodes { id name }
}
}
GRAPHQL
# Then fetch its issues
linear api <<'GRAPHQL'
query {
project(id: "<id>") {
issues(first: 50) {
nodes { identifier title state { name } assignee { name } priority }
}
}
}
GRAPHQL
通过 GraphQL 进行全文搜索
CLI 没有内置搜索命令,但 api 子命令提供了完整的 GraphQL API:
linear api --variable term="onboarding" <<'GRAPHQL'
query($term: String!) {
searchIssues(term: $term, first: 20) {
nodes { identifier title state { name } assignee { name } }
}
}
GRAPHQL
使用 jq 管道进行筛选:
linear api --variable term="bug" <<'GRAPHQL'
query($term: String!) {
searchIssues(term: $term, first: 20) {
nodes { identifier title state { name } }
}
}
GRAPHQL
更新问题
# Mark as started (sets state to "In Progress")
# NOTE: linear issue update fails with "Could not determine team key from issue ID"
# for non-standard prefixes (e.g. EF2-123). Use GraphQL mutation instead (see below).
linear issue update ENG-123 -s started
# Update title or description
linear issue update ENG-123 -t "New title"
linear issue update ENG-123 --description-file /tmp/desc.md
# Add a comment
linear issue comment add ENG-123 -b "Started implementation"
# For multi-line markdown comments, use a file
linear issue comment add ENG-123 --body-file /tmp/comment.md
通过 GraphQL 更新问题状态(CLI 更新失败时)
# Find the state ID first
linear api <<'GRAPHQL'
query {
workflowStates(filter: { name: { eq: "Done" } }) {
nodes { id name team { key } }
}
}
GRAPHQL
# Then update one or more issues in a single mutation
linear api <<'GRAPHQL'
mutation {
issueUpdate(id: "EF2-123", input: { stateId: "<state-id>" }) { success }
}
GRAPHQL
# Batch update multiple issues
linear api <<'GRAPHQL'
mutation {
a: issueUpdate(id: "EF2-436", input: { stateId: "<state-id>" }) { success }
b: issueUpdate(id: "EF2-435", input: { stateId: "<state-id>" }) { success }
}
GRAPHQL
创建问题
# Interactive (prompts for details)
linear issue create
# Non-interactive
linear issue create -t "Fix rendering bug" --description-file /tmp/desc.md -a self -s unstarted
# Create and immediately start working
linear issue create -t "Investigate flaky test" --start
对于多行 Markdown 内容,始终使用 --description-file 或 --body-file,以避免 shell 转义问题。
查找 CLI 选项
每个命令都支持 --help:
linear --help
linear issue --help
linear issue list --help
linear issue create --help
CLI 除问题相关命令外,还有大量子命令——linear team、linear project、linear document、linear label、linear milestone。对其中任意命令运行 --help。
工作区参考
在变更操作中直接使用这些 ID,无需先查询。
用户
| 名称 | ID |
|---|---|
| Collin Miller | 7fa0b8f1-b1d2-462a-8edd-5365fb5e1d4a |
| Jeremy Yudkin | 12ae7fdb-6af1-45fd-b656-a1052b387605 |
工作流状态(团队:EF2)
| 状态 | ID | 类型 |
|---|---|---|
| 待办列表 | deceb52d-a969-493a-974c-228d0e595e08 | backlog |
| 待处理 | fb95e2be-9938-42bf-8248-276d4b1af951 | unstarted |
| 进行中 | ac7b4c8f-d2a9-4e74-a9ff-392506703bd2 | started |
| 审核中 | 2717b5fe-9ea0-429f-8edd-cf8eabe0551d | started |
| 已完成 | 5fcec8c5-d69d-4cf4-bcad-e73654b2fae2 | completed |
| 已取消 | 1fbe9606-44eb-486c-8521-daf848673435 | canceled |
| 重复 | ec2113c9-0b49-407a-82e1-3d1f39c7037a | canceled |
项目
| 名称 | ID | 状态 |
|---|---|---|
| Editframe 2026 发布 / Bug 修复 | b43b5d1d-8431-4e19-b4ae-c05760c02996 | planned |
| 发布用应用和仪表板 | 5fbea590-482f-4fcd-89f3-b0e581e43546 | started |
| 演示改进(发布前) | 6c616f08-8bc9-4f8c-9109-26863099ffc3 | started |
| Dev Rel Catnip | 90b4643c-9b09-43fc-8fd8-9e78de7669a5 | started |
| Bug 修复 | 9c2beb23-32c3-4c24-a896-ca69eb99da49 | started |
| Clean Slate 任务集 | 12e632b9-6ce7-4a06-8403-46b419e3f649 | started |
| 文档 / 网站反馈(2025) | 4ccf4054-9b6a-4ccf-85e6-088fe60851e4 | started |
| EF - 渲染改进 | fd8a3df6-e174-41ee-a7f2-b7d49bca6094 | backlog |
| EF - 预览改进 | 4772c169-6f0f-4c01-b408-801ebd49bb3a | backlog |
| 发布文档 Beta | f8babb39-f732-4611-999e-f7db4d0aa48c | backlog |
| 堆栈跟踪项目 | e2f37910-6a4f-4f45-a877-889c62526e6b | planned |
何时使用此技能
- 用户提供 Linear issue ID 并希望开始处理
- 用户要求查找或搜索 Linear issue
- 用户想查看分配给自己的内容,或处于特定状态的内容
- 用户要求更新 issue 状态或添加评论
- Agent 需要在开始实现前阅读 issue 需求