π« A comprehensive command-line tool for managing Linear tickets with AI-agent friendly interfaces
This tool provides complete Linear ticket management capabilities through an intuitive CLI, designed to work seamlessly with AI agents, automation scripts, and human users.
# 1. Set your Linear API token (REQUIRED)
export LINEAR_API_TOKEN="your_token_here"
# 2. Basic usage - create a ticket
linear add --title "Fix authentication bug" --team "Backend"
# Output: β
Successfully created ticket: ZIF-123
# 3. Search for tickets
linear "ZIF-123"
# Output: Full ticket details
# 4. List available resources
linear --teams # See all teams
linear --projects # See all projects
linear --assignees # See all users- Installation
- Authentication
- Core Features
- AI Agent Usage Guide
- Command Reference
- Examples
- Automation & Scripting
- Troubleshooting
- Python 3.7 or higher
- Linear workspace access
- Linear API token
Install via pip (LIVE on PyPI!):
pip install linear-ticket-cliInstall directly from GitHub:
pip install git+https://github.com/vittoridavide/linear-cli.gitAfter installation, you can use the linear command directly:
linear --helpOption 1: Quick Setup (Recommended)
git clone https://github.com/vittoridavide/linear-cli.git
cd linear-cli
./dev-setup.shOption 2: Manual Setup
git clone https://github.com/vittoridavide/linear-cli.git
cd linear-cli
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .Option 3: Legacy Method (Clone and Run)
git clone https://github.com/vittoridavide/linear-cli.git
cd linear-cli
pip install -r requirements.txt
# Use: python linear_search.py instead of linear-
Get Linear API Token
- Go to Linear β Settings β API β Personal API tokens
- Create new token with read/write permissions
- Copy the token
-
Configure Authentication
export LINEAR_API_TOKEN="your_linear_api_token_here" # Add to ~/.zshrc or ~/.bashrc for persistence
Environment Variable (Recommended):
export LINEAR_API_TOKEN="lin_api_..."Command Line Override:
linear --token "lin_api_..." add --title "Test ticket"- π Smart Ticket Search - Natural language queries, direct ID lookup
- π― Ticket Creation - Full metadata support (teams, projects, assignees, labels)
- βοΈ Ticket Updates - Status, title, description, priority, assignee changes
- π Resource Discovery - List teams, projects, users, labels, workflow states
- π€ AI-Agent Friendly - Detailed help text, consistent output formats
- π Script Integration - JSON output modes, exit codes, ID-only responses
- β‘ Performance - Local caching for fast searches
- π Real-time Sync - Automatic cache refresh after modifications
# Get available teams (required for ticket creation)
linear --teams
# Output: 1. Backend, 2. Frontend Engineering, 3. DevOps
# Get available projects
linear --projects
# Output: 1. Q4 Features, 2. Bug Fixes, 3. Technical Debt
# Get available users for assignment
linear --assignees
# Output: 1. John Smith (john@company.com), 2. Jane Doe (jane@company.com)
# Get workflow states for status updates
linear --states
# Output: Backend: Todo, In Progress, In Review, Done# Basic creation (minimal required info)
linear add --title "Fix login issue" --team "Backend"
# Output: β
Successfully created ticket: ZIF-124
# Full creation with all metadata
linear add \
--title "Add user dashboard" \
--description "Create comprehensive user management interface" \
--team "Frontend Engineering" \
--project "Q4 Features" \
--assignee "john@company.com" \
--priority high \
--labels "feature,frontend,ui"
# Output: β
Successfully created ticket: ZIF-125# Get only ticket ID for automation
TICKET_ID=$(linear add --title "Automated task" --team "Backend" --id-only)
echo "Created: $TICKET_ID"
# Output: Created: ZIF-126
# Search and update
linear "$TICKET_ID" --status "In Progress" --assignee "jane@company.com"
# Output: β
Updated ticket: ZIF-126- Always validate resources first - Run
--teams,--projects,--assigneesbefore creating tickets - Use exact names - Team and project names are case-sensitive
- Wrap parameters in quotes - Especially for titles, descriptions, and names with spaces
- Check exit codes - Non-zero exit codes indicate errors
- Use
--id-onlyfor scripting - Clean output perfect for variable capture - Handle errors gracefully - Commands show specific error messages with suggestions
linear add [OPTIONS]
Required:
--title "Ticket Title" # Main ticket heading
Optional:
--description "Detailed description" # Supports markdown
--team "Team Name" # From --teams output
--project "Project Name" # From --projects output
--assignee "user@email.com" # From --assignees output
--priority urgent|high|normal|low # Or numeric 1|2|3|4
--labels "bug,frontend,critical" # Comma-separated, no spaces
--parent "ZIF-19" # Parent ticket ID
--id-only # Return only ticket ID
Examples:
linear add --title "Fix bug" --team "Backend"
linear add --title "New feature" --team "Frontend" --project "Q4" --id-onlylinear "QUERY" [OPTIONS]
Query Types:
"ZIF-19" # Direct ticket lookup
"project: Issues, Epic 1" # Project + epic search
"bug authentication" # Keyword search
Options:
--limit 5 # Max results (default: 10)
Examples:
linear "ZIF-123"
linear "project: Backend database" --limit 5
linear "critical bug" --limit 3linear "TICKET-ID" [UPDATE_OPTIONS]
Update Options:
--status "Status Name" # From --states output
--title "New Title" # Replace existing title
--description "New description" # Replace existing description
--priority urgent|high|normal|low # Or numeric 1|2|3|4
--assignee "user@email.com" # From --assignees, or "none" to unassign
Examples:
linear "ZIF-19" --status "Done"
linear "ZIF-19" --assignee "user@company.com" --priority high
linear "ZIF-19" --title "Updated title" --status "In Review"linear --teams # List all teams
linear --projects # List all projects
linear --assignees # List all users
linear --labels # List all labels
linear --states # List workflow states
linear --refresh # Update local cache# 1. Discover resources
TEAMS=$(linear --teams)
USERS=$(linear --assignees)
# 2. Create bug ticket
BUG_ID=$(linear add \
--title "Login fails with OAuth" \
--description "Users cannot authenticate via OAuth provider" \
--team "Backend" \
--assignee "backend-lead@company.com" \
--priority urgent \
--labels "bug,authentication,critical" \
--id-only)
echo "Created bug report: $BUG_ID"
# 3. Update as work progresses
linear "$BUG_ID" --status "In Progress"
linear "$BUG_ID" --description "Root cause identified: OAuth callback URL misconfigured"
linear "$BUG_ID" --status "In Review"
linear "$BUG_ID" --status "Done"# 1. Create parent feature
FEATURE_ID=$(linear add \
--title "User Dashboard v2" \
--description "Redesigned user dashboard with analytics" \
--team "Frontend" \
--project "Q4 Features" \
--priority high \
--id-only)
# 2. Create sub-tasks
SUBTASK1=$(linear add \
--title "Dashboard layout component" \
--parent "$FEATURE_ID" \
--team "Frontend" \
--assignee "ui-dev@company.com" \
--id-only)
SUBTASK2=$(linear add \
--title "Analytics integration" \
--parent "$FEATURE_ID" \
--team "Frontend" \
--assignee "data-dev@company.com" \
--id-only)
echo "Feature: $FEATURE_ID, Subtasks: $SUBTASK1, $SUBTASK2"# Check my assigned tickets
linear "assignee: john@company.com"
# Create quick ticket
linear add --title "Fix header alignment" --team "Frontend"
# Update ticket status
linear "ZIF-45" --status "Done"
# Search for recent bugs
linear "bug" --limit 50- Success1- Error (validation failed, API error, ticket not found)2- Invalid arguments
#!/bin/bash
# Create deployment ticket
DEPLOY_ID=$(linear add \
--title "Deploy v${VERSION} to production" \
--description "Automated deployment of version ${VERSION}" \
--team "DevOps" \
--assignee "$DEPLOY_ENGINEER" \
--labels "deployment,production" \
--id-only)
if [ $? -eq 0 ]; then
echo "Deployment tracked in ticket: $DEPLOY_ID"
# Update ticket during deployment
linear "$DEPLOY_ID" --status "In Progress"
# Deploy application...
if deploy_application; then
linear "$DEPLOY_ID" --status "Done" --description "Successfully deployed v${VERSION}"
else
linear "$DEPLOY_ID" --status "Failed" --description "Deployment failed: check logs"
exit 1
fi
else
echo "Failed to create deployment ticket"
exit 1
fi#!/bin/bash
# Process multiple tickets
TICKETS=("ZIF-10" "ZIF-11" "ZIF-12")
for ticket in "${TICKETS[@]}"; do
echo "Processing $ticket..."
linear "$ticket" --status "Done" --assignee "none"
if [ $? -eq 0 ]; then
echo "β
Updated $ticket"
else
echo "β Failed to update $ticket"
fi
done# Problem: "LINEAR_API_TOKEN environment variable not set"
# Solution:
export LINEAR_API_TOKEN="your_token_here"
# Problem: "400 Client Error: Bad Request"
# Solution: Check token permissions in Linear settings# Problem: "Team 'backend' not found"
# Solution: Check exact team name
linear --teams # See available teams
# Problem: "User 'john' not found"
# Solution: Use email or exact display name
linear --assignees # See available users# Problem: "No tickets found"
# Solution: Refresh cache and check query
linear --refresh
linear --projects # Verify project names# Add --token flag to see API requests
linear --token "$LINEAR_API_TOKEN" add --title "Debug test"linear --help # Main help
linear add --help # Ticket creation helplinear-cli/
βββ linear_search.py # Main CLI application
βββ linear_client.py # Linear API client
βββ ticket_search.py # Search engine and ticket operations
βββ requirements.txt # Python dependencies
βββ setup_alias.sh # Installation helper
βββ .env.example # Environment template
βββ .gitignore # Git ignore rules
βββ README.md # This file
We welcome contributions! This tool is designed to be AI-agent friendly while maintaining excellent usability for humans.
- Fork the repository on GitHub
- Clone your fork locally
- Set up development environment (see Installation section)
- Make your changes following our development principles
- Test thoroughly with real Linear workspaces
- Submit a pull request with detailed description
When extending functionality:
- Add detailed help text - Include examples and validation notes
- Use consistent output formats - Maintain JSON-friendly responses
- Handle errors gracefully - Provide actionable error messages
- Document new features - Update README with AI-agent examples
- Test with real scenarios - Validate against actual Linear workspaces
For detailed contribution guidelines, see CONTRIBUTING.md.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for the Linear community
- Designed with AI agents in mind
- Inspired by the need for powerful CLI tools in modern development workflows
If you encounter issues or have questions:
- Check the troubleshooting section in this README
- Review existing issues
- Create a new issue with detailed information
- Consider contributing a fix!
- Linear - The excellent project management tool this CLI interacts with
- Linear API - Official Linear API documentation
Built for AI agents, humans, and automation. Happy ticket managing! π«