|
| 1 | +# Jira Cloud Integration |
| 2 | + |
| 3 | +This document describes how to set up and use the Jira Cloud integration with Wellcode CLI as an alternative to Linear for issue tracking metrics. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The Jira Cloud integration provides comprehensive issue tracking analytics including: |
| 8 | + |
| 9 | +- **Issue Flow Metrics**: Creation, completion, and in-progress tracking |
| 10 | +- **Issue Type Analysis**: Bugs, Stories, Tasks, and Epics breakdown |
| 11 | +- **Cycle Time Metrics**: Time from creation to resolution |
| 12 | +- **Estimation Accuracy**: Story points vs actual time analysis |
| 13 | +- **Project Performance**: Per-project metrics and health indicators |
| 14 | +- **Assignee Performance**: Individual contributor metrics |
| 15 | +- **Priority Distribution**: Issue priority analysis |
| 16 | +- **Component & Version Tracking**: Component and fix version metrics |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +1. **Jira Cloud Instance**: You need access to a Jira Cloud instance (*.atlassian.net) |
| 21 | +2. **API Token**: Generate an API token from your Atlassian account |
| 22 | +3. **Permissions**: Read access to projects and issues you want to analyze |
| 23 | + |
| 24 | +## Setup Instructions |
| 25 | + |
| 26 | +### 1. Generate Jira API Token |
| 27 | + |
| 28 | +1. Go to [Atlassian Account Security](https://id.atlassian.com/manage-profile/security/api-tokens) |
| 29 | +2. Click "Create API token" |
| 30 | +3. Give it a descriptive name (e.g., "Wellcode CLI") |
| 31 | +4. Copy the generated token (you won't be able to see it again) |
| 32 | + |
| 33 | +### 2. Configure Wellcode CLI |
| 34 | + |
| 35 | +Run the configuration command: |
| 36 | + |
| 37 | +```bash |
| 38 | +wellcode-cli config |
| 39 | +``` |
| 40 | + |
| 41 | +When prompted for Jira configuration, provide: |
| 42 | + |
| 43 | +- **Domain**: Your Jira domain (e.g., `mycompany` for `mycompany.atlassian.net`) |
| 44 | +- **Email**: Your Atlassian account email address |
| 45 | +- **API Token**: The token you generated in step 1 |
| 46 | + |
| 47 | +The CLI will test the connection and save your configuration if successful. |
| 48 | + |
| 49 | +### 3. Verify Setup |
| 50 | + |
| 51 | +Test your configuration by running: |
| 52 | + |
| 53 | +```bash |
| 54 | +wellcode-cli review |
| 55 | +``` |
| 56 | + |
| 57 | +You should see Jira metrics alongside your GitHub metrics. |
| 58 | + |
| 59 | +## Usage |
| 60 | + |
| 61 | +### Basic Usage |
| 62 | + |
| 63 | +```bash |
| 64 | +# Review last 7 days (default) |
| 65 | +wellcode-cli review |
| 66 | + |
| 67 | +# Review specific date range |
| 68 | +wellcode-cli review --start-date 2024-01-01 --end-date 2024-01-31 |
| 69 | + |
| 70 | +# Review specific user's issues |
| 71 | +wellcode-cli review --user "john.doe@company.com" |
| 72 | +``` |
| 73 | + |
| 74 | +### Filtering Options |
| 75 | + |
| 76 | +- `--user`: Filter by assignee (use email address or Jira username) |
| 77 | +- `--start-date`: Start date for analysis (YYYY-MM-DD format) |
| 78 | +- `--end-date`: End date for analysis (YYYY-MM-DD format) |
| 79 | + |
| 80 | +## Metrics Explained |
| 81 | + |
| 82 | +### Issue Flow Metrics |
| 83 | + |
| 84 | +- **Issues Created**: Total issues created in the time period |
| 85 | +- **Issues Completed**: Issues moved to "Done" status |
| 86 | +- **Completion Rate**: Percentage of created issues that were completed |
| 87 | +- **Issue Types**: Breakdown by Bugs, Stories, Tasks, and Epics |
| 88 | + |
| 89 | +### Cycle Time Metrics |
| 90 | + |
| 91 | +- **Average Cycle Time**: Mean time from creation to resolution |
| 92 | +- **Median Cycle Time**: 50th percentile cycle time |
| 93 | +- **95th Percentile**: 95th percentile cycle time (helps identify outliers) |
| 94 | +- **Resolution Time**: Time to close/resolve issues |
| 95 | + |
| 96 | +### Estimation Accuracy |
| 97 | + |
| 98 | +- **Accuracy Rate**: Percentage of estimates within 25% of actual time |
| 99 | +- **Underestimates**: Issues that took longer than estimated |
| 100 | +- **Overestimates**: Issues that took less time than estimated |
| 101 | +- **Variance**: Average percentage difference between estimate and actual |
| 102 | + |
| 103 | +### Project Performance |
| 104 | + |
| 105 | +- **Completion Rate**: Per-project completion percentage |
| 106 | +- **Issue Distribution**: Breakdown by issue types per project |
| 107 | +- **Assignee Involvement**: Number of people working on each project |
| 108 | +- **Project Lead**: Project lead information |
| 109 | +- **Project Type**: Software, Business, etc. |
| 110 | + |
| 111 | +## Customization |
| 112 | + |
| 113 | +### Story Points Field |
| 114 | + |
| 115 | +The integration looks for story points in the `customfield_10016` field by default. If your Jira instance uses a different field for story points, you can modify this in the code: |
| 116 | + |
| 117 | +```python |
| 118 | +# In src/wellcode_cli/jira/models/metrics.py |
| 119 | +story_points = fields.get("customfield_XXXXX") # Replace XXXXX with your field ID |
| 120 | +``` |
| 121 | + |
| 122 | +To find your story points field ID: |
| 123 | +1. Go to Jira Settings → Issues → Custom Fields |
| 124 | +2. Find your Story Points field |
| 125 | +3. Note the field ID (usually in the format `customfield_XXXXX`) |
| 126 | + |
| 127 | +### Time Estimation |
| 128 | + |
| 129 | +The integration supports both: |
| 130 | +- **Story Points**: Converted to hours (1 point = 4 hours by default) |
| 131 | +- **Time Estimates**: Original time estimates in Jira |
| 132 | + |
| 133 | +## Troubleshooting |
| 134 | + |
| 135 | +### Common Issues |
| 136 | + |
| 137 | +1. **Authentication Failed** |
| 138 | + - Verify your email address is correct |
| 139 | + - Ensure your API token is valid and not expired |
| 140 | + - Check that your domain is correct (without .atlassian.net) |
| 141 | + |
| 142 | +2. **No Issues Found** |
| 143 | + - Verify the date range includes issues |
| 144 | + - Check that you have read permissions for the projects |
| 145 | + - Ensure issues exist in the specified time period |
| 146 | + |
| 147 | +3. **Missing Metrics** |
| 148 | + - Some metrics require specific Jira configurations (story points, time tracking) |
| 149 | + - Ensure your Jira instance has the required fields enabled |
| 150 | + |
| 151 | +### Debug Mode |
| 152 | + |
| 153 | +Enable debug logging to troubleshoot issues: |
| 154 | + |
| 155 | +```bash |
| 156 | +export WELLCODE_DEBUG=1 |
| 157 | +wellcode-cli review |
| 158 | +``` |
| 159 | + |
| 160 | +### API Rate Limits |
| 161 | + |
| 162 | +Jira Cloud has API rate limits: |
| 163 | +- 300 requests per minute for most endpoints |
| 164 | +- The integration uses pagination to handle large datasets efficiently |
| 165 | + |
| 166 | +## Security |
| 167 | + |
| 168 | +- API tokens are stored locally in `~/.wellcode/config.json` |
| 169 | +- Tokens are transmitted over HTTPS only |
| 170 | +- No data is sent to external services except Jira Cloud |
| 171 | + |
| 172 | +## Comparison with Linear |
| 173 | + |
| 174 | +| Feature | Jira Cloud | Linear | |
| 175 | +|---------|------------|--------| |
| 176 | +| Issue Types | Bugs, Stories, Tasks, Epics | Issues with Labels | |
| 177 | +| Projects | Native project support | Team-based organization | |
| 178 | +| Time Tracking | Built-in time tracking | Estimation-based | |
| 179 | +| Custom Fields | Extensive customization | Limited custom fields | |
| 180 | +| Workflow | Configurable workflows | Fixed workflow states | |
| 181 | +| API Rate Limits | 300/minute | 1000/hour | |
| 182 | + |
| 183 | +## Advanced Configuration |
| 184 | + |
| 185 | +### Environment Variables |
| 186 | + |
| 187 | +You can also configure Jira using environment variables: |
| 188 | + |
| 189 | +```bash |
| 190 | +export JIRA_DOMAIN="mycompany" |
| 191 | +export JIRA_EMAIL="user@company.com" |
| 192 | +export JIRA_API_KEY="your-api-token" |
| 193 | +``` |
| 194 | + |
| 195 | +### JQL Customization |
| 196 | + |
| 197 | +The integration uses JQL (Jira Query Language) to fetch issues. The default query is: |
| 198 | + |
| 199 | +```jql |
| 200 | +created >= 'YYYY-MM-DD' AND created <= 'YYYY-MM-DD' |
| 201 | +``` |
| 202 | + |
| 203 | +For advanced users, you can modify the JQL in `src/wellcode_cli/jira/jira_metrics.py`. |
| 204 | + |
| 205 | +## Support |
| 206 | + |
| 207 | +For issues with the Jira integration: |
| 208 | + |
| 209 | +1. Check the troubleshooting section above |
| 210 | +2. Enable debug mode for detailed logs |
| 211 | +3. Verify your Jira permissions and configuration |
| 212 | +4. Create an issue in the Wellcode CLI repository with debug logs |
| 213 | + |
| 214 | +## Contributing |
| 215 | + |
| 216 | +To contribute to the Jira integration: |
| 217 | + |
| 218 | +1. Fork the repository |
| 219 | +2. Create a feature branch |
| 220 | +3. Add tests for new functionality |
| 221 | +4. Submit a pull request |
| 222 | + |
| 223 | +The Jira integration follows the same patterns as other integrations in the codebase for consistency and maintainability. |
0 commit comments