Setup Scripts
Cyrus supports automated repository initialization through setup scripts that run when creating new Git worktrees for Linear issues. This powerful feature allows you to prepare the development environment automatically for each task.Overview
When Cyrus processes a Linear issue, it:- Creates a new Git worktree for isolation
- Runs setup scripts to prepare the environment
- Processes the issue in the prepared worktree
- Cleans up the worktree after completion
Repository Setup Script
Creating a Repository Script
Place acyrus-setup.sh script in your repository root:
Available Environment Variables
Cyrus provides these environment variables to your script:LINEAR_ISSUE_ID: The Linear issue ID (UUID format)LINEAR_ISSUE_IDENTIFIER: The issue identifier (e.g., “CEA-123”)LINEAR_ISSUE_TITLE: The issue title
When to Use Repository Scripts
Common Use Cases:- Dependency Installation:
npm install,pip install -r requirements.txt - Environment Configuration: Copy
.envfiles, set up credentials - Database Setup: Create test databases, run migrations
- Build Steps: Compile code, generate assets
- Service Startup: Start local services needed for development
Script Best Practices
Exit on Error
Always useset -e to exit immediately if any command fails:
Keep Scripts Fast
Setup scripts delay issue processing. Keep them fast:- Cache dependencies when possible
- Skip unnecessary steps
- Use parallel installation when available
Timeout and Error Handling
- Timeout: Scripts have a 5-minute timeout
- Failure Behavior: Script failures don’t prevent worktree creation
- Logs: Script output appears in Cyrus logs for debugging
Testing Your Script
Test the script locally before relying on it:Advanced Patterns
Conditional Setup Based on Issue
Run different setup based on issue labels or title:Caching Dependencies
Speed up setup by caching dependencies:Parallel Setup
Run independent setup tasks in parallel:Issue-Specific Configuration
Create configuration specific to each issue:Troubleshooting
Script Not Running
Check:- Script exists at repository root
- Script is named exactly
cyrus-setup.sh - Script has execute permissions (
chmod +x cyrus-setup.sh) - Script has correct shebang (
#!/bin/bash)
Script Failing
Debug Steps:- Test script locally with test environment variables
- Check Cyrus logs for script output and errors
- Add echo statements to identify where script fails
- Verify all dependencies and commands are available
- Missing dependencies (e.g.,
npmnot in PATH) - Permission errors (e.g., can’t write to directories)
- Timeout (script takes longer than 5 minutes)
Script Timeout
If scripts consistently timeout:-
Optimize dependency installation:
-
Skip unnecessary steps:
- Cache dependencies: See caching pattern above
Script Works Locally But Fails in Cyrus
Check that:- All paths are relative or use environment variables
- All required tools are installed in the Cyrus environment
- No interactive prompts (scripts must run non-interactively)
Next: Remote Hosting

