Linear
Manage issues, check project status, and stay on top of your team's work.
Setup
CODEBLOCK0
Discover team keys:
CODEBLOCK1
If LINEAR_DEFAULT_TEAM is set, you can omit the team key in team and call:
CODEBLOCK2
Quick Commands
CODEBLOCK3
Common Workflows
Morning Standup
{baseDir}/scripts/linear.sh standup
Shows: your todos, blocked items across team, recently completed, what's in review.
Quick Issue Creation (from chat)
CODEBLOCK5
Triage Mode
CODEBLOCK6
Git Workflow (Linear ↔ GitHub Integration)
Always use Linear-derived branch names to enable automatic issue status tracking.
Getting the Branch Name
CODEBLOCK7
Creating a Worktree for an Issue
CODEBLOCK8
⚠️ Never modify files on main. All changes happen in worktrees only.
Why This Matters
- - Linear's GitHub integration tracks PRs by branch name pattern
- When you create a PR from a Linear branch, the issue automatically moves to "In Review"
- When the PR merges, the issue automatically moves to "Done"
- Manual branch names break this automation
- Keeping main clean = no accidental pushes, easy worktree cleanup
Quick Reference
CODEBLOCK9
Priority Levels
| Level | Value | Use for |
|---|
| urgent | 1 | Production issues, blockers |
| high |
2 | This week, important |
| medium | 3 | This sprint/cycle |
| low | 4 | Nice to have |
| none | 0 | Backlog, someday |
Teams (cached)
Team keys and IDs are discovered via the API and cached locally after the first lookup.
Use linear.sh teams to refresh and list available teams.
Notes
- - Uses GraphQL API (api.linear.app/graphql)
- Requires
LINEAR_API_KEY env var - Issue identifiers are like INLINECODE4
Attribution
Inspired by schpet/linear-cli by Peter Schilling (ISC License).
This is an independent bash implementation for Clawdbot integration.
Linear
管理工作项、检查项目状态,并实时掌握团队工作进展。
环境配置
bash
export LINEARAPIKEY=your-api-key
可选:当命令需要指定团队时的默认团队标识
export LINEAR
DEFAULTTEAM=TEAM
查看团队标识:
bash
{baseDir}/scripts/linear.sh teams
如果已设置 LINEARDEFAULTTEAM,可以在 team 命令中省略团队标识,直接调用:
bash
{baseDir}/scripts/linear.sh create 标题 [描述]
快捷命令
bash
我的工作项
{baseDir}/scripts/linear.sh my-issues # 分配给您的工单
{baseDir}/scripts/linear.sh my-todos # 仅显示待办事项
{baseDir}/scripts/linear.sh urgent # 团队内紧急/高优先级事项
浏览
{baseDir}/scripts/linear.sh teams # 列出可用团队
{baseDir}/scripts/linear.sh team <团队标识> # 查看团队所有工单
{baseDir}/scripts/linear.sh project <名称> # 查看项目内工单
{baseDir}/scripts/linear.sh issue
# 获取工单详情
{baseDir}/scripts/linear.sh branch # 获取GitHub分支名称
操作
{baseDir}/scripts/linear.sh create <团队标识> 标题 [描述]
{baseDir}/scripts/linear.sh comment 评论内容
{baseDir}/scripts/linear.sh status
{baseDir}/scripts/linear.sh assign <用户名>
{baseDir}/scripts/linear.sh priority
概览
{baseDir}/scripts/linear.sh standup # 每日站会摘要
{baseDir}/scripts/linear.sh projects # 所有项目及进度
常见工作流程
晨会站会
bash
{baseDir}/scripts/linear.sh standup
显示:您的待办事项、团队内被阻塞项、最近完成项、待审核项。
快速创建工单(从聊天界面)
bash
{baseDir}/scripts/linear.sh create TEAM 修复认证超时错误 用户登录5分钟后自动登出
分类处理模式
bash
{baseDir}/scripts/linear.sh urgent # 查看需要优先处理的事项
Git 工作流(Linear ↔ GitHub 集成)
始终使用 Linear 生成的分支名称,以实现工单状态的自动追踪。
获取分支名称
bash
{baseDir}/scripts/linear.sh branch TEAM-212
返回:dev/team-212-fix-auth-timeout-bug
为工单创建工作树
bash
1. 从 Linear 获取分支名称
BRANCH=$({baseDir}/scripts/linear.sh branch TEAM-212)
2. 先拉取最新的 main 分支(main 必须始终与远程仓库一致)
cd /path/to/repo
git checkout main && git pull origin main
3. 使用该分支创建工作树(从最新的 origin/main 创建)
git worktree add .worktrees/team-212 -b $BRANCH origin/main
cd .worktrees/team-212
4. 进行开发、提交、推送
git push -u origin $BRANCH
⚠️ 切勿直接修改 main 分支上的文件。 所有更改仅在独立工作树中进行。
为何如此重要
- - Linear 的 GitHub 集成通过分支名称模式追踪拉取请求
- 从 Linear 分支创建 PR 时,工单自动移至审核中状态
- PR 合并后,工单自动移至已完成状态
- 手动命名分支会破坏此自动化机制
- 保持 main 分支整洁 = 避免意外推送,轻松清理工作树
快速参考
bash
完整工作流示例
ISSUE=TEAM-212
BRANCH=$({baseDir}/scripts/linear.sh branch $ISSUE)
始终从最新的 main 分支开始
cd ~/workspace/your-repo
git checkout main && git pull origin main
创建工作树(位于 .worktrees/ 目录下)
git worktree add .worktrees/${ISSUE,,} -b $BRANCH origin/main
cd .worktrees/${ISSUE,,}
... 进行修改 ...
git add -A && git commit -m fix: implement $ISSUE
git push -u origin $BRANCH
gh pr create --title $ISSUE: <标题> --body Closes $ISSUE
优先级级别
| 级别 | 值 | 适用场景 |
|---|
| urgent | 1 | 生产问题、阻塞项 |
| high |
2 | 本周内、重要事项 |
| medium | 3 | 当前冲刺/周期内 |
| low | 4 | 锦上添花 |
| none | 0 | 待办清单、未来计划 |
团队(缓存)
团队标识和 ID 通过 API 获取,首次查询后本地缓存。
使用 linear.sh teams 刷新并列出可用团队。
注意事项
- - 使用 GraphQL API(api.linear.app/graphql)
- 需要设置 LINEARAPIKEY 环境变量
- 工单标识格式如 TEAM-123
致谢
灵感来源于 Peter Schilling 的 schpet/linear-cli(ISC 许可证)。
这是为 Clawdbot 集成开发的独立 bash 实现。