@wkronmiller/linear-task-queue
v1.0.0
Published
Orchestrates OpenCode sessions to work through Linear project backlogs with real-time webhooks and polling fallback
Maintainers
Readme
Linear Task Queue
Linear Task Queue orchestrates Opencode
sessions to work through Linear project backlogs.
For every repository defined in ~/.config/linear-task-queue/config.json,
the service spins up a local Opencode server, fetches Todo issues for the
configured Linear project, and prompts Opencode to resolve each ticket within
the matching local Git checkout.
Quick Start
Hybrid Mode (Default)
The system runs both webhook and polling for maximum reliability:
- Install dependencies:
npm install. - Configure environment variables in
.env:LINEAR_API_KEY=your_linear_api_key # Optional: Enable webhooks for real-time processing WEBHOOK_URL=https://your-domain.com/webhook WEBHOOK_PORT=3000 # Optional: Configure logging level (debug, info, warn, error) LOG_LEVEL=info - Create
~/.config/linear-task-queue/config.jsondescribing the repositories to manage:{ "repos": [ { "name": "example-service", "localPath": "/home/me/code/example-service", "linear": { "team": "team-id", "project": "Website Revamp" } } ] } - Run the application:
# Development with auto-reload npm run dev # Production npm run build npm start
Smart Mode Detection: The application automatically detects available features:
- Webhook + Polling: If
WEBHOOK_URLis configured (recommended) - Polling Only: If only
LINEAR_API_KEYis set
Development
- Development Mode: Use
npm run devfor hybrid mode with live reload - Build:
npm run buildcompiles the project todist/ - Configuration: Config is loaded at startup, restart to apply changes
- Logging: Set
LOG_LEVEL=debugfor verbose development logging
API Endpoints (When Webhooks Enabled)
GET /status- Comprehensive system status including component health, queues, and webhook registrationPOST /webhook- Linear webhook endpoint (automatically configured)
Features
Architecture
- Hybrid Processing: Real-time webhooks with polling fallback for maximum reliability
- Structured Logging: Winston-based logging with configurable levels and contextual metadata
- Unified Configuration: Single source of truth with automatic validation
- Error Handling: Comprehensive error recovery with timeout protection and graceful shutdown
- Health Monitoring: Component-level health checks with centralized status reporting
Operational Excellence
- Zero-Downtime: Graceful shutdown handling for all deployment scenarios
- Monitoring: Detailed status endpoint for operational visibility
- Security: Webhook signature verification and request validation
- Scalability: Modular architecture supporting horizontal scaling
Deployment
PM2 (Recommended)
PM2 provides process management and automatic restart capabilities:
- Build the TypeScript output:
npm run build - Start the process with the included configuration:
Thepm2 start ecosystem.config.cjs --env productionecosystem.config.cjsfile runs the compileddist/index.jsentry point withNODE_ENV=production. - Register PM2 with your init system so it restarts on boot, then persist the process list:
Run the command thatpm2 startup pm2 savepm2 startupprints before executingpm2 saveso the process list is stored for resurrection. - Use
pm2 statusandpm2 logs linear-task-queueto inspect the process, and apply config or code changes by rebuilding (npm run build) and runningpm2 restart linear-task-queue.
Environment Variables
LINEAR_API_KEY- Required: Linear API key with team accessWEBHOOK_URL- Optional: Public HTTPS URL for webhook endpointWEBHOOK_PORT- Optional: Port for webhook server (default: 3000)LOG_LEVEL- Optional: Logging level (debug, info, warn, error, default: info)NODE_ENV- Optional: Environment mode (development, production)
