|
1 | 1 | --- |
2 | 2 | name: linear-cli |
3 | | -description: Manage Linear.app issues, projects, and teams from the command line. Use this skill when working with Linear issues, creating tasks, updating status, or integrating Linear into development workflows. 10-50x more token-efficient than Linear MCP tools. |
| 3 | +description: Manage Linear.app issues, projects, and teams from the command line. Use this skill when working with Linear issues, creating tasks, updating status, searching, creating PRs, or downloading attachments. 10-50x more token-efficient than Linear MCP tools. |
4 | 4 | license: MIT |
5 | 5 | metadata: |
6 | 6 | author: Finesssee |
7 | 7 | version: "0.2.9" |
8 | 8 | repository: https://github.com/Finesssee/linear-cli |
| 9 | +allowed-tools: Bash |
9 | 10 | --- |
10 | 11 |
|
11 | 12 | # Linear CLI |
12 | 13 |
|
13 | | -A powerful CLI for Linear.app that is optimized for AI agent usage. Use `linear-cli` for all Linear operations instead of MCP tools - it's 10-50x more token-efficient. |
| 14 | +A powerful CLI for Linear.app optimized for AI agents. **Always use this instead of Linear MCP tools** - it's 10-50x more token-efficient. |
14 | 15 |
|
15 | 16 | ## Installation |
16 | 17 |
|
17 | 18 | ```bash |
18 | | -# From crates.io |
19 | 19 | cargo install linear-cli |
20 | | - |
21 | | -# With secure API key storage (OS keyring) |
22 | | -cargo install linear-cli --features secure-storage |
23 | 20 | ``` |
24 | 21 |
|
25 | 22 | ## Authentication |
26 | 23 |
|
27 | 24 | ```bash |
28 | | -# Set API key via environment variable (recommended for CI/agents) |
| 25 | +# Environment variable (recommended for agents) |
29 | 26 | export LINEAR_API_KEY="lin_api_xxxxx" |
30 | 27 |
|
31 | | -# Or authenticate interactively |
| 28 | +# Or interactive login |
32 | 29 | linear-cli auth login |
33 | | - |
34 | | -# With secure storage (stores in OS keyring) |
35 | | -linear-cli auth login --secure |
36 | 30 | ``` |
37 | 31 |
|
38 | | -Get your API key from: https://linear.app/settings/api |
| 32 | +Get API key: https://linear.app/settings/api |
| 33 | + |
| 34 | +--- |
39 | 35 |
|
40 | 36 | ## Quick Reference |
41 | 37 |
|
42 | 38 | ### Issues |
43 | 39 |
|
44 | | -| Task | Command | |
45 | | -|------|---------| |
46 | | -| List issues | `linear-cli i list` | |
47 | | -| List my issues | `linear-cli i list --assignee me` | |
48 | | -| Filter by team | `linear-cli i list -t ENG` | |
49 | | -| Filter by status | `linear-cli i list -s "In Progress"` | |
50 | | -| Get issue | `linear-cli i get LIN-123` | |
51 | | -| Get multiple | `linear-cli i get LIN-1 LIN-2 LIN-3` | |
52 | | -| Create issue | `linear-cli i create "Title" -t TEAM` | |
53 | | -| Create with priority | `linear-cli i create "Bug" -t ENG -p 1` | |
54 | | -| Update status | `linear-cli i update LIN-123 -s Done` | |
55 | | -| Start work | `linear-cli i start LIN-123` | |
56 | | -| Start + checkout branch | `linear-cli i start LIN-123 --checkout` | |
57 | | -| Stop work | `linear-cli i stop LIN-123` | |
58 | | - |
59 | | -### Projects & Teams |
60 | | - |
61 | | -| Task | Command | |
62 | | -|------|---------| |
63 | | -| List projects | `linear-cli p list` | |
64 | | -| List teams | `linear-cli t list` | |
65 | | -| Get project | `linear-cli p get PROJECT-ID` | |
66 | | - |
67 | | -### Search & Context |
68 | | - |
69 | | -| Task | Command | |
70 | | -|------|---------| |
71 | | -| Search issues | `linear-cli s issues "query"` | |
72 | | -| Get current context | `linear-cli context` | |
73 | | -| Get comments | `linear-cli cm list ISSUE-ID` | |
| 40 | +```bash |
| 41 | +# List issues |
| 42 | +linear-cli i list # All issues |
| 43 | +linear-cli i list -t ENG # Filter by team |
| 44 | +linear-cli i list -s "In Progress" # Filter by status |
| 45 | +linear-cli i list --assignee me # My issues |
| 46 | + |
| 47 | +# Get issue(s) |
| 48 | +linear-cli i get LIN-123 # Single issue |
| 49 | +linear-cli i get LIN-1 LIN-2 LIN-3 # Multiple issues |
| 50 | + |
| 51 | +# Create issue |
| 52 | +linear-cli i create "Title" -t TEAM # Basic |
| 53 | +linear-cli i create "Bug" -t ENG -p 1 # With priority (1=urgent) |
| 54 | +linear-cli i create "Task" -t ENG -a me # Assign to self |
| 55 | +linear-cli i create "Fix" -t ENG -l bug # With label |
| 56 | +linear-cli i create "Due" -t ENG --due +3d # Due in 3 days |
| 57 | + |
| 58 | +# Update issue |
| 59 | +linear-cli i update LIN-123 -s Done # Change status |
| 60 | +linear-cli i update LIN-123 -p 2 # Change priority |
| 61 | +linear-cli i update LIN-123 -a "John" # Assign to user |
| 62 | + |
| 63 | +# Start/stop work |
| 64 | +linear-cli i start LIN-123 --checkout # Assign + In Progress + git branch |
| 65 | +linear-cli i stop LIN-123 # Unassign + reset status |
| 66 | +``` |
| 67 | + |
| 68 | +### Search |
| 69 | + |
| 70 | +```bash |
| 71 | +linear-cli s issues "auth bug" # Search issues |
| 72 | +linear-cli s projects "backend" # Search projects |
| 73 | +``` |
74 | 74 |
|
75 | 75 | ### Git Integration |
76 | 76 |
|
77 | | -| Task | Command | |
78 | | -|------|---------| |
79 | | -| Create PR for issue | `linear-cli g pr LIN-123` | |
80 | | -| Link branch to issue | `linear-cli g link LIN-123` | |
| 77 | +```bash |
| 78 | +linear-cli g pr LIN-123 # Create PR for issue |
| 79 | +linear-cli g pr LIN-123 --draft # Draft PR |
| 80 | +linear-cli g checkout LIN-123 # Create/checkout branch |
| 81 | +linear-cli context # Get issue from current branch |
| 82 | +``` |
81 | 83 |
|
82 | | -## Agent-Optimized Flags |
| 84 | +### Comments |
| 85 | + |
| 86 | +```bash |
| 87 | +linear-cli cm list LIN-123 # List comments |
| 88 | +linear-cli cm create LIN-123 -b "Done" # Add comment |
| 89 | +``` |
83 | 90 |
|
84 | | -These flags make output suitable for programmatic consumption: |
| 91 | +### Attachments |
85 | 92 |
|
86 | | -| Flag | Purpose | |
87 | | -|------|---------| |
88 | | -| `--output json` | JSON output (machine-readable) | |
89 | | -| `--output ndjson` | Newline-delimited JSON (streaming) | |
90 | | -| `--compact` | No pretty-printing (saves tokens) | |
91 | | -| `--fields a,b,c` | Select specific fields only | |
92 | | -| `--sort field` | Sort by field (supports nested: `state.name`) | |
93 | | -| `--order asc\|desc` | Sort direction | |
94 | | -| `--quiet` | Suppress decorative output | |
95 | | -| `--id-only` | Only output the ID (for chaining) | |
96 | | -| `--dry-run` | Preview without executing | |
97 | | -| `-` (stdin) | Read input from pipe | |
| 93 | +```bash |
| 94 | +linear-cli up fetch "URL" -f image.png # Download to file |
| 95 | +``` |
98 | 96 |
|
99 | | -### Examples |
| 97 | +### Teams & Projects |
100 | 98 |
|
101 | 99 | ```bash |
102 | | -# Get issue as compact JSON |
103 | | -linear-cli i get LIN-123 --output json --compact |
| 100 | +linear-cli t list # List teams |
| 101 | +linear-cli p list # List projects |
| 102 | +``` |
| 103 | + |
| 104 | +--- |
104 | 105 |
|
105 | | -# List issues with specific fields only |
106 | | -linear-cli i list -t ENG --output json --fields identifier,title,state.name |
| 106 | +## Agent-Optimized Flags |
| 107 | + |
| 108 | +**ALWAYS use these for programmatic access:** |
| 109 | + |
| 110 | +| Flag | Purpose | Example | |
| 111 | +|------|---------|---------| |
| 112 | +| `--output json` | JSON output | `linear-cli i list --output json` | |
| 113 | +| `--compact` | No formatting (saves tokens) | `--output json --compact` | |
| 114 | +| `--fields a,b` | Select fields only | `--fields identifier,title,state.name` | |
| 115 | +| `--sort field` | Sort results | `--sort priority` or `--sort state.name` | |
| 116 | +| `--quiet` | No decorative output | `-q` | |
| 117 | +| `--id-only` | Return only ID | For chaining commands | |
| 118 | +| `--dry-run` | Preview only | Test before creating | |
107 | 119 |
|
108 | | -# Create issue and capture ID for chaining |
109 | | -ID=$(linear-cli i create "Task" -t ENG --id-only) |
| 120 | +### Recommended Pattern |
110 | 121 |
|
111 | | -# Preview without creating |
112 | | -linear-cli i create "Test" -t ENG --dry-run |
| 122 | +```bash |
| 123 | +# Token-efficient issue listing |
| 124 | +linear-cli i list -t ENG --output json --compact --fields identifier,title,state.name |
113 | 125 |
|
114 | | -# Pipe description from file |
115 | | -cat description.md | linear-cli i create "Title" -t ENG -d - |
| 126 | +# Create and capture ID |
| 127 | +ID=$(linear-cli i create "Bug" -t ENG --id-only) |
116 | 128 |
|
117 | | -# Set default JSON output for session |
| 129 | +# Set JSON as default for session |
118 | 130 | export LINEAR_CLI_OUTPUT=json |
119 | 131 | ``` |
120 | 132 |
|
| 133 | +--- |
| 134 | + |
121 | 135 | ## Exit Codes |
122 | 136 |
|
123 | | -| Code | Meaning | |
124 | | -|------|---------| |
125 | | -| 0 | Success | |
126 | | -| 1 | General error | |
127 | | -| 2 | Not found | |
128 | | -| 3 | Authentication error | |
129 | | -| 4 | Rate limited | |
| 137 | +| Code | Meaning | Action | |
| 138 | +|------|---------|--------| |
| 139 | +| 0 | Success | Continue | |
| 140 | +| 1 | General error | Check stderr | |
| 141 | +| 2 | Not found | Verify ID exists | |
| 142 | +| 3 | Auth error | Check LINEAR_API_KEY | |
| 143 | +| 4 | Rate limited | Wait and retry | |
| 144 | + |
| 145 | +--- |
130 | 146 |
|
131 | 147 | ## Priority Values |
132 | 148 |
|
133 | | -| Value | Meaning | |
134 | | -|-------|---------| |
| 149 | +| Value | Level | |
| 150 | +|-------|-------| |
135 | 151 | | 0 | No priority | |
136 | 152 | | 1 | Urgent | |
137 | 153 | | 2 | High | |
138 | 154 | | 3 | Normal | |
139 | 155 | | 4 | Low | |
140 | 156 |
|
| 157 | +--- |
| 158 | + |
141 | 159 | ## Due Date Shortcuts |
142 | 160 |
|
143 | | -The `--due` flag accepts: |
144 | | -- `today`, `tomorrow`, `yesterday` |
145 | | -- `+3d` (3 days from now) |
146 | | -- `+2w` (2 weeks from now) |
147 | | -- `monday`, `tue`, `friday` (next occurrence) |
148 | | -- `eow` (end of week) |
149 | | -- `eom` (end of month) |
150 | | -- `2024-03-15` (ISO date) |
151 | | - |
152 | | -## Best Practices for Agents |
153 | | - |
154 | | -1. **Always use `--output json`** for parsing responses |
155 | | -2. **Use `--compact`** to reduce token usage |
156 | | -3. **Use `--fields`** to fetch only needed data |
157 | | -4. **Use `--id-only`** when chaining commands |
158 | | -5. **Use `--quiet`** to suppress decorative output |
159 | | -6. **Check exit codes** for error handling |
160 | | -7. **Use short aliases**: `i` (issues), `p` (projects), `t` (teams), `s` (search), `cm` (comments) |
| 161 | +| Input | Meaning | |
| 162 | +|-------|---------| |
| 163 | +| `today` | Today | |
| 164 | +| `tomorrow`, `tom` | Tomorrow | |
| 165 | +| `+3d` | 3 days from now | |
| 166 | +| `+2w` | 2 weeks from now | |
| 167 | +| `monday`, `tue` | Next occurrence | |
| 168 | +| `eow` | End of week | |
| 169 | +| `eom` | End of month | |
| 170 | +| `2024-03-15` | Specific date | |
| 171 | + |
| 172 | +--- |
161 | 173 |
|
162 | 174 | ## Common Workflows |
163 | 175 |
|
164 | | -### Start working on an issue |
| 176 | +### Start Working on Issue |
165 | 177 | ```bash |
166 | 178 | linear-cli i start LIN-123 --checkout |
167 | | -# Creates/checks out git branch and sets status to "In Progress" |
| 179 | +# Creates branch, assigns to you, sets "In Progress" |
168 | 180 | ``` |
169 | 181 |
|
170 | | -### Create issue and assign to self |
| 182 | +### Complete Issue and Create PR |
171 | 183 | ```bash |
172 | | -linear-cli i create "Fix bug" -t ENG -a me -p 2 |
| 184 | +# After committing changes |
| 185 | +linear-cli g pr LIN-123 |
| 186 | +linear-cli i update LIN-123 -s Done |
173 | 187 | ``` |
174 | 188 |
|
175 | | -### Update issue with labels |
| 189 | +### Find and Update Issue |
176 | 190 | ```bash |
177 | | -linear-cli i update LIN-123 -l bug -l urgent |
| 191 | +# Search |
| 192 | +linear-cli s issues "login bug" --output json |
| 193 | + |
| 194 | +# Update the found issue |
| 195 | +linear-cli i update LIN-456 -s "In Progress" -a me |
178 | 196 | ``` |
179 | 197 |
|
180 | | -### Get current issue from git branch |
| 198 | +### Get Issue from Current Branch |
181 | 199 | ```bash |
182 | 200 | linear-cli context --output json |
| 201 | +# Returns issue details based on branch name |
183 | 202 | ``` |
184 | 203 |
|
185 | | -### Batch operations |
186 | | -```bash |
187 | | -# Get multiple issues |
188 | | -linear-cli i get LIN-1 LIN-2 LIN-3 --output json |
| 204 | +--- |
189 | 205 |
|
190 | | -# Read IDs from stdin |
191 | | -echo "LIN-1\nLIN-2" | linear-cli i get - |
192 | | -``` |
| 206 | +## Tips |
| 207 | + |
| 208 | +1. **Use short aliases**: `i` (issues), `t` (teams), `p` (projects), `s` (search), `g` (git), `cm` (comments) |
| 209 | +2. **Always `--output json`** for parsing |
| 210 | +3. **Use `--compact`** to save tokens |
| 211 | +4. **Use `--fields`** to fetch only needed data |
| 212 | +5. **Use `--id-only`** when chaining commands |
| 213 | +6. **Check exit codes** for error handling |
| 214 | +7. **Use `--dry-run`** to preview create operations |
0 commit comments