mcpField
L
linear-cli

linear-cli

github.com/letta-ai开发152113 次安装4 周前更新
代码仓库

关于 linear-cli

linear-cli 是用于从命令行管理 Linear 问题及相关项目工作的技能,面向需要在终端操作 Linear 的开发者。它还涵盖 git 和 jj 集成,并建议优先使用 CLI 支持的操作。

主要功能

  1. 01管理 Linear 问题和团队
  2. 02管理项目、状态更新与周期
  3. 03管理里程碑和计划
  4. 04支持 git 与 jj 集成
  5. 05可用 GraphQL API 补充 CLI 操作

适用场景

  1. 01从终端创建或更新问题
  2. 02查看和管理团队周期
  3. 03处理 CLI 未覆盖的 GraphQL 查询

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/letta-ai/skills --skill linear-cli

安装后在 Claude Code 中输入/linear-cli确认已加载。

附带文件assets/linear-small.svgLICENSE

详细介绍

Linear CLI

用于从命令行管理 Linear 问题的 CLI,集成了 git 和 jj。

前置条件

linear 命令必须位于 PATH 中。检查方法:

linear --version

如果尚未安装,请按照以下说明操作: https://github.com/schpet/linear-cli?tab=readme-ov-file#install

Markdown 内容最佳实践

处理包含 Markdown 的问题描述或评论正文时,始终优先使用基于文件的标志,而不是将内容作为命令行参数传递:

  • 对于 issue create 和 issue update 命令,使用 --description-file
  • 对于 comment add 和 comment update 命令,使用 --body-file

使用基于文件的标志的原因:

  • 确保内容在 Linear 网页界面中正确显示
  • 避免换行符和特殊字符的 shell 转义问题
  • 防止 Markdown 中出现字面量 \n 序列
  • 便于处理多行内容

示例工作流:

# Write markdown to a temporary file
cat > /tmp/description.md <<'EOF'
## Summary

- First item
- Second item

## Details

This is a detailed description with proper formatting.
EOF

# Create issue using the file
linear issue create --title "My Issue" --description-file /tmp/description.md

# Or for comments
linear issue comment add ENG-123 --body-file /tmp/comment.md

仅在简单的单行内容中使用内联标志(--description、--body)。

可用命令

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 cycle              # Manage Linear team cycles
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 api                # Make a raw GraphQL API request

查找选项

若要查看可用的子命令和标志,请对任意命令运行 --help:

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

每条命令的详细帮助信息都会介绍所有可用的标志和选项。

直接使用 Linear GraphQL API

对于所有受支持的操作,优先使用 CLI。 只有在 CLI 未涵盖相关查询时,才应将 api 命令用作备用方案。

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

将架构写入临时文件,然后搜索:

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"
发起 GraphQL 请求

重要: 包含非空类型标记(例如 String 后跟感叹号)的 GraphQL 查询,必须通过 heredoc 标准输入传递,以避免转义问题。不含此类标记的简单查询可以内联传递。

# Simple query (no type markers, so inline is fine)
linear api '{ viewer { id name email } }'

# Query with variables — use heredoc to avoid escaping issues
linear api --variable teamId=abc123 <<'GRAPHQL'
query($teamId: String!) { team(id: $teamId) { name } }
GRAPHQL

# Search issues by text
linear api --variable term=onboarding <<'GRAPHQL'
query($term: String!) { searchIssues(term: $term, first: 20) { nodes { identifier title state { name } } } }
GRAPHQL

# Pipe to jq for filtering
linear api '{ issues(first: 5) { nodes { identifier title } } }' | jq '.data.issues.nodes[].title'
高级用法:直接使用 curl

如果需要完整的 HTTP 控制,请使用 linear auth token:

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

评论

支持 Markdown