Skip to content

Latest commit

 

History

History
123 lines (87 loc) · 2.99 KB

README.md

File metadata and controls

123 lines (87 loc) · 2.99 KB

linear cli

cli tool for linear.app that uses git branch names and directory names to open issues and team pages. offers handy commands:

  • linear issue open the issue in linear.app, based on the current git branch
  • linear issue print print it to stdout
  • linear issue pr create a nicely named pull request with gh
  • linear team view active issues assigned to you in the team

see the full list of commands below.

install

homebrew

todo

deno via jsr

deno install --allow-env --allow-sys --allow-run --allow-read --allow-net -g -n linear jsr:@schpet/linear-cli

deno via local

git clone https://github.com/schpet/linear-cli
cd linear-cli
deno task install

setup

this cli needs three things to work:

  1. a linear api key, found at https://linear.app/settings/api
  2. your current git branch to start with a linear issue id, e.g. eng-123-my-feature
  3. the directory of your repo to start with a linear team id, e.g. eng-my-project

required environment variables

LINEAR_API_KEY="lin_api_..." # create an api key at https://linear.app/settings/api
LINEAR_WORKSPACE="your-company" # your linear.app workspace url slug
bash

add to ~/.bashrc:

export LINEAR_API_KEY="lin_api_..."
export LINEAR_WORKSPACE="your-company"
zsh

add to ~/.zshrc:

export LINEAR_API_KEY="lin_api_..."
export LINEAR_WORKSPACE="your-company"
fish

run in terminal:

set -Ux LINEAR_API_KEY "lin_api_..."
set -Ux LINEAR_WORKSPACE "your-company"

commands

issue commands

the current issue is determined by the issue id in the current git branch name. note that linear's github integration will suggest these branch names.

linear issue           # opens current branch's issue in Linear.app
linear issue open      # same as above
linear issue print     # prints issue title and description (with markdown formatting)
linear issue id        # prints the issue id from current branch (e.g., "ENG-123")
linear issue title     # prints just the issue title
linear issue url       # prints the Linear.app URL for the issue
linear issue pr        # creates a GitHub PR with issue details via `gh pr create`

team commands

name your repo directories with your project's linear team prefix for these to work. i.e. if your linear team prefix is 'ENG' mv ~/code/cool-project ~/code/eng-cool-project

linear team             # opens team page in Linear.app
linear team open        # same as above
linear team id          # prints the team id (e.g., "ENG")
linear team autolinks   # configures GitHub repository autolinks for Linear issues

other commands

linear --help          # show all commands
linear --version       # show version
linear completions     # generate shell completions