linear-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Linear CLI

Linear CLI

A CLI to manage Linear issues from the command line, with git and jj integration.
Generated from linear CLI v1.8.1
一款可从命令行管理Linear事项的CLI工具,支持git和jj集成。
基于Linear CLI v1.8.1生成

Prerequisites

前置条件

The
linear
command must be available on PATH. To check:
bash
linear --version
If not installed, follow the instructions at:
https://github.com/schpet/linear-cli?tab=readme-ov-file#install
linear
命令必须在PATH环境变量中可用。检查方式:
bash
linear --version
若未安装,请按照以下链接中的说明操作:
https://github.com/schpet/linear-cli?tab=readme-ov-file#install

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 (timeline posts)
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 auth               # 管理Linear身份验证
linear issue              # 管理Linear事项
linear team               # 管理Linear团队
linear project            # 管理Linear项目
linear project-update     # 管理项目状态更新
linear milestone          # 管理Linear项目里程碑
linear initiative         # 管理Linear倡议
linear initiative-update  # 管理倡议状态更新(时间线帖子)
linear label              # 管理Linear事项标签
linear document           # 管理Linear文档
linear config             # 交互式生成.linear.toml配置文件
linear schema             # 将GraphQL架构打印到标准输出

Reference Documentation

参考文档

  • auth - Manage Linear authentication
  • issue - Manage Linear issues
  • team - Manage Linear teams
  • project - Manage Linear projects
  • project-update - Manage project status updates
  • milestone - Manage Linear project milestones
  • initiative - Manage Linear initiatives
  • initiative-update - Manage initiative status updates (timeline posts)
  • label - Manage Linear issue labels
  • document - Manage Linear documents
  • config - Interactively generate .linear.toml configuration
  • schema - Print the GraphQL schema to stdout
For curated examples of organization features (initiatives, labels, projects, bulk operations), see organization-features.
  • auth - 管理Linear身份验证
  • issue - 管理Linear事项
  • team - 管理Linear团队
  • project - 管理Linear项目
  • project-update - 管理项目状态更新
  • milestone - 管理Linear项目里程碑
  • initiative - 管理Linear倡议
  • initiative-update - 管理倡议状态更新(时间线帖子)
  • label - 管理Linear事项标签
  • document - 管理Linear文档
  • config - 交互式生成.linear.toml配置文件
  • schema - 将GraphQL架构打印到标准输出
关于组织功能(倡议、标签、项目、批量操作)的精选示例,请查看organization-features

Discovering Options

查看可用选项

To see available subcommands and flags, run
--help
on any command:
bash
linear --help
linear issue --help
linear issue list --help
linear issue create --help
Each command has detailed help output describing all available flags and options.
要查看可用的子命令和标志,在任意命令后添加
--help
运行:
bash
linear --help
linear issue --help
linear issue list --help
linear issue create --help
每个命令都有详细的帮助输出,说明所有可用的标志和选项。

Using the Linear GraphQL API Directly

直接使用Linear GraphQL API

Prefer the CLI for all supported operations. Direct API calls via curl are slower and should only be used as a fallback for advanced queries not covered by the CLI. For complex queries involving multiple calls, write and execute a script.
To make direct API calls, use
linear schema
and
linear auth token
:
对于所有支持的操作,优先使用CLI。 通过curl直接调用API速度较慢,仅应作为CLI未覆盖的高级查询的备选方案。对于涉及多次调用的复杂查询,请编写并执行脚本。
要直接调用API,请使用
linear schema
linear auth token

1. Check the schema for available types and fields

1. 查看可用类型和字段的架构

Write the schema to a tempfile, then search it:
bash
undefined
将架构写入临时文件,然后搜索:
bash
undefined

Write schema to a tempfile (cross-platform)

将架构写入临时文件(跨平台)

linear schema -o "${TMPDIR:-/tmp}/linear-schema.graphql"
linear schema -o "${TMPDIR:-/tmp}/linear-schema.graphql"

Search for specific types or fields

搜索特定类型或字段

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

View filter options

查看过滤选项

grep -A 50 "^input IssueFilter" "${TMPDIR:-/tmp}/linear-schema.graphql"
undefined
grep -A 50 "^input IssueFilter" "${TMPDIR:-/tmp}/linear-schema.graphql"
undefined

2. Get the auth token

2. 获取身份验证令牌

bash
linear auth token
bash
linear auth token

3. Make a curl request

3. 发起curl请求

bash
curl -s -X POST https://api.linear.app/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: $(linear auth token)" \
  -d '{"query": "{ issues(filter: { team: { key: { eq: \"CLI\" } } }, first: 5) { nodes { identifier title state { name } } } }"}'
bash
curl -s -X POST https://api.linear.app/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: $(linear auth token)" \
  -d '{"query": "{ issues(filter: { team: { key: { eq: \"CLI\" } } }, first: 5) { nodes { identifier title state { name } } } }"}'

Example queries

示例查询

bash
undefined
bash
undefined

Get issues assigned to current user

获取分配给当前用户的事项

curl -s -X POST https://api.linear.app/graphql
-H "Content-Type: application/json"
-H "Authorization: $(linear auth token)"
-d '{"query": "{ viewer { assignedIssues(first: 10) { nodes { identifier title state { name } } } } }"}'
undefined
curl -s -X POST https://api.linear.app/graphql
-H "Content-Type: application/json"
-H "Authorization: $(linear auth token)"
-d '{"query": "{ viewer { assignedIssues(first: 10) { nodes { identifier title state { name } } } } }"}'
undefined