A comprehensive command-line tool for managing Linear tickets with AI-agent friendly interfaces
Project description
Linear Ticket Manager CLI
๐ซ 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.
๐ Quick Start for AI Agents
# 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
๐ Table of Contents
- Installation
- Authentication
- Core Features
- AI Agent Usage Guide
- Command Reference
- Examples
- Automation & Scripting
- Troubleshooting
๐ Installation
Prerequisites
- Python 3.7 or higher
- Linear workspace access
- Linear API token
๐ Quick Installation (Recommended)
Install via pip (coming soon to PyPI):
pip install linear-cli
Install directly from GitHub:
pip install git+https://github.com/vittoridavide/linear-cli.git
After installation, you can use the linear command directly:
linear --help
๐ง Development Installation
Option 1: Quick Setup (Recommended)
git clone https://github.com/vittoridavide/linear-cli.git
cd linear-cli
./dev-setup.sh
Option 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
๐ Authentication Setup
-
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
๐ Authentication
Environment Variable (Recommended):
export LINEAR_API_TOKEN="lin_api_..."
Command Line Override:
linear --token "lin_api_..." add --title "Test ticket"
โจ Core Features
- ๐ 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
๐ค AI Agent Usage Guide
Step-by-Step Workflow for AI Agents
1. Resource Discovery (ALWAYS DO THIS FIRST)
# 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
2. Create Tickets with Validation
# 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
3. Script-Friendly Operations
# 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
AI Agent Best Practices
- 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
๐ Command Reference
Ticket Creation
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-only
Ticket Search
linear "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 3
Ticket Updates
linear "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"
Utility Commands
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
๐ก Examples
For AI Agents - Complete Workflows
Create and Track a Bug Report
# 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"
Create Feature with Sub-tasks
# 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"
For Humans - Interactive Usage
Daily Ticket Management
# 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 5
๐ง Automation & Scripting
Exit Codes
0- Success1- Error (validation failed, API error, ticket not found)2- Invalid arguments
Scripting Examples
CI/CD Integration
#!/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
Batch Operations
#!/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
๐ Troubleshooting
Common Issues
Authentication Errors
# 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
Validation Errors
# 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
Search Issues
# Problem: "No tickets found"
# Solution: Refresh cache and check query
linear --refresh
linear --projects # Verify project names
Debug Mode
# Add --token flag to see API requests
linear --token "$LINEAR_API_TOKEN" add --title "Debug test"
Getting Help
linear --help # Main help
linear add --help # Ticket creation help
๐ Project Structure
linear-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
๐ค Contributing
We welcome contributions! This tool is designed to be AI-agent friendly while maintaining excellent usability for humans.
Quick Start for Contributors
- 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
Development Principles
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.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built for the Linear community
- Designed with AI agents in mind
- Inspired by the need for powerful CLI tools in modern development workflows
๐ Support
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!
๐ Related Projects
- 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! ๐ซ
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file linear_ticket_cli-1.0.0.tar.gz.
File metadata
- Download URL: linear_ticket_cli-1.0.0.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f972707235208652ef4a76d8dfaca87f58a975598e7498e297d3c94dd542575
|
|
| MD5 |
39e75cea3dd0ad1d6c2b759a4baa7d0c
|
|
| BLAKE2b-256 |
d2dc9969ce90eb43319aae86804ff72efc13875c219c77de9f0527eb963b50aa
|
File details
Details for the file linear_ticket_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: linear_ticket_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58ed4d94a7399c7d7b2d0ad9e6518553d7fcd1eae1ca188e743f1c184805f019
|
|
| MD5 |
7359d3e147906bca8af66e4c960aa179
|
|
| BLAKE2b-256 |
dddd9fa723437155badba6070ca87699a0414563595672a61f83d4725f263aaf
|