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 分支上修改文件。 所有更改仅在 worktrees 中进行。
为什么这很重要
- - Linear 的 GitHub 集成通过分支名称模式跟踪 PR
- 当你从 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 实现。