Linear CLI:通过终端管理问题和项目 - Openclaw Skills

作者:互联网

2026-03-30

AI教程

什么是 Linear?

Openclaw Skills 的 Linear 技能提供了一个全面的命令行界面,以便高效地与您的 Linear 工作空间进行交互。它允许开发人员在不离开终端的情况下处理问题的整个生命周期——从创建和分配到进度跟踪和完成。通过桥接项目管理和本地编码环境之间的鸿沟,该技能显著提高了开发者的速度。

它专为处理复杂工作流而设计,提供了与 git 和 jj 等版本控制系统的深度集成。无论您是在管理团队里程碑、更新项目状态,还是查询 Linear GraphQL API 以获取自定义数据,此 Openclaw Skills 集成都能确保您的项目管理与代码一样快速。

下载入口:https://github.com/openclaw/skills/tree/main/skills/cipher-shad0w/openclaw-linear

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install openclaw-linear

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 openclaw-linear。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Linear 应用场景

  • 在活跃的开发会话期间立即创建和更新问题。
  • 从 CLI 自动化项目状态更新和里程碑跟踪。
  • 自动将本地 git 分支与 Linear 问题标识符同步。
  • 查询 Linear GraphQL API 以进行自定义数据导出或高级自动化。
  • 直接从本地 markdown 文件管理团队文档和项目规范。
Linear 工作原理
  1. 使用生成的 API 密钥或交互式登录命令验证您的 Linear 工作空间。
  2. 通过环境变量或 .linear.toml 文件配置项目特定设置,以设置默认团队和工作空间。
  3. 执行高级 CLI 命令以获取、创建或修改问题、项目和标签。
  4. 利用内置的 VCS 集成自动创建并切换到链接到特定问题 ID 的分支。
  5. 访问原始 GraphQL API 备用方案,以进行需要直接数据库交互的复杂查询和过滤。

Linear 配置指南

确保 linear 命令在您的 PATH 中可用。您可以通过多种方式安装它:

# 通过 Homebrew 安装
brew install schpet/tap/linear

# 通过 Deno 安装
deno install -A --reload -f -g -n linear jsr:@schpet/linear-cli

安装后,请按照以下步骤为您的工作空间配置 Openclaw Skills:

  1. 在 https://linear.app/settings/account/security 创建 API 密钥。
  2. 运行 linear auth login 以验证您的会话。
  3. 导航到您的项目存储库并运行 linear config 以生成本地配置。

Linear 数据架构与分类体系

该技能通过本地配置文件和远程 API 对象的组合来管理数据。以下是数据的组织方式:

组件 来源 用途
.linear.toml 本地文件 存储团队 ID、工作空间缩略名和 VCS 偏好 (git/jj)。
GraphQL Schema 远程 API 定义问题、项目、团队和文档的结构。
环境变量 Shell 环境 覆盖团队 ID 和问题排序的配置 (LINEAR_TEAM_ID 等)。
元数据 Openclaw 跟踪安装要求和操作系统兼容性 (Darwin, Linux, Win32)。
name: linear
description: Manage Linear issues, projects, teams, and documents from the command line using the linear CLI. Create, update, list, and track issues; manage projects and milestones; interact with the Linear GraphQL API.
homepage: https://github.com/cipher-shad0w/openclaw-linear
metadata: {"openclaw": {"emoji": "???", "os": ["darwin", "linux", "win32"], "requires": {"bins": ["linear"]}, "install": [{"id": "brew", "kind": "brew", "formula": "schpet/tap/linear", "bins": ["linear"], "label": "Install linear CLI (brew)", "os": ["darwin", "linux"]}]}}

Linear

A CLI to manage Linear issues from the command line, with git and jj integration.

Prerequisites

The linear command must be available on PATH. To check:

linear --version

If not installed:

  • Homebrew: brew install schpet/tap/linear
  • Deno: deno install -A --reload -f -g -n linear jsr:@schpet/linear-cli
  • Binaries: https://github.com/schpet/linear-cli/releases/latest

Setup

  1. Create an API key at https://linear.app/settings/account/security
  2. Authenticate: linear auth login
  3. Configure your project: cd my-project-repo && linear config

Available Commands

linear auth               # Manage Linear authentication
linear issue              # Manage Linear issues
linear team               # Manage Linear teams
linear project            # Manage Linear projects
linear project-update     # Manage project status updates
linear milestone          # Manage Linear project milestones
linear initiative         # Manage Linear initiatives
linear initiative-update  # Manage initiative status updates
linear label              # Manage Linear issue labels
linear document           # Manage Linear documents
linear config             # Interactively generate .linear.toml configuration
linear schema             # Print the GraphQL schema to stdout
linear api                # Make a raw GraphQL API request

Common Workflows

List and view issues

# List your unstarted issues
linear issue list

# List issues in a specific state
linear issue list -s started
linear issue list -s completed

# List all assignees' issues
linear issue list -A

# View the current branch's issue
linear issue view

# View a specific issue
linear issue view ABC-123

Create and manage issues

# Create an issue interactively
linear issue create

# Create non-interactively
linear issue create -t "Fix login bug" -d "Users can't log in with SSO" -s "In Progress" -a self --priority 1

# Update an issue
linear issue update ABC-123 -s "Done" -t "Updated title"

# Add a comment
linear issue comment add ABC-123 -b "This is fixed in the latest build"

# Delete an issue
linear issue delete ABC-123 -y

Start working on an issue

# Pick an issue interactively, creates a git branch and marks it as started
linear issue start

# Start a specific issue
linear issue start ABC-123

# Create a PR with issue details pre-filled
linear issue pr

Projects and milestones

# List projects
linear project list

# Create a project
linear project create -n "Q1 Launch" -t ENG -s started --target-date 2026-03-31

# List milestones for a project
linear milestone list --project 

Documents

# List documents
linear document list

# Create a document from a file
linear document create --title "Design Spec" --content-file ./spec.md --project 

# View a document
linear document view 

Teams

# List teams
linear team list

# List team members
linear team members

Discovering Options

Run --help on any command for flags and options:

linear --help
linear issue --help
linear issue list --help
linear issue create --help

Using the Linear GraphQL API Directly

Prefer the CLI for all supported operations. The api command is a fallback for queries not covered by the CLI.

Check the schema

linear schema -o "${TMPDIR:-/tmp}/linear-schema.graphql"
grep -i "cycle" "${TMPDIR:-/tmp}/linear-schema.graphql"
grep -A 30 "^type Issue " "${TMPDIR:-/tmp}/linear-schema.graphql"

Make a GraphQL request

# Simple query
linear api '{ viewer { id name email } }'

# With variables
linear api 'query($teamId: String!) { team(id: $teamId) { name } }' --variable teamId=abc123

# Complex filter via JSON
linear api 'query($filter: IssueFilter!) { issues(filter: $filter) { nodes { title } } }' r
  --variables-json '{"filter": {"state": {"name": {"eq": "In Progress"}}}}'

# Pipe to jq
linear api '{ issues(first: 5) { nodes { identifier title } } }' | jq '.data.issues.nodes[].title'

Using curl directly

curl -s -X POST https://api.linear.app/graphql r
  -H "Content-Type: application/json" r
  -H "Authorization: $(linear auth token)" r
  -d '{"query": "{ viewer { id } }"}'

Reference Documentation

For detailed subcommand documentation with all flags and options:

  • issue - Manage Linear issues (list, create, update, start, view, comment, PR, delete)
  • team - Manage Linear teams (list, create, delete, members, autolinks)
  • project - Manage Linear projects (list, view, create)
  • document - Manage Linear documents (list, view, create, update, delete)
  • api - Make raw GraphQL API requests

Configuration

The CLI supports environment variables or a .linear.toml config file:

Option Env Var TOML Key Example
Team ID LINEAR_TEAM_ID team_id "ENG"
Workspace LINEAR_WORKSPACE workspace "mycompany"
Issue sort LINEAR_ISSUE_SORT issue_sort "priority" or "manual"
VCS LINEAR_VCS vcs "git" or "jj"

Config file locations (checked in order):

  1. ./linear.toml or ./.linear.toml (current directory)
  2. /linear.toml or /.linear.toml
  3. /.config/linear.toml
  4. ~/.config/linear/linear.toml