Skip to content

Phase 3: Add JIRA Integration via IssueTracker Interface #238

Description

@acreeger

This is a potential Phase 3 task for implementing JIRA ticketing integration (see parent issue #210).

Research conducted by Opus agent with comprehensive findings on JIRA integration feasibility.

Executive Summary

JIRA integration into iloom's IssueTracker interface abstraction is feasible and architecturally sound, but presents more complexity than GitHub or Linear due to JIRA's enterprise-grade feature set, multiple deployment models (Cloud vs Server/Data Center), and alphanumeric issue key format.

Recommendation: JIRA as Phase 3 candidate with 8-12 days estimated effort.

Prerequisites

Overview

Add JIRA integration through the IssueTracker interface abstraction, enabling full JIRA ticketing functionality while maintaining provider abstraction pattern.


1. Recommended CLI Tool: ankitpokhrel/jira-cli

Best option for iloom integration:

  • GitHub: https://github.com/ankitpokhrel/jira-cli
  • JSON Output: jira issue list --raw provides machine-readable output
  • Comprehensive Operations: Issue create, view, edit, assign, move/transition, link, comment
  • Authentication: Basic auth (API token), Bearer (PAT), MTLS (certificates)
  • Cross-Platform: Available via Homebrew, Scoop, or binary releases

Example Commands:

# Get issue in JSON format
jira issue view PROJ-123 --raw

# List issues with JQL
jira issue list --jql "project = PROJ AND status = 'In Progress'" --raw

# Create issue
jira issue create --project PROJ --type Story --summary "Title" --body "Description"

# Transition issue
jira issue move PROJ-123 "In Progress"

Alternative: Atlassian ACLI (Official)

  • Official Atlassian Command Line Interface
  • JSON flag: acli jira workitem view KEY-123 --json
  • Multi-product: Works with Jira, Confluence, Bitbucket

2. IssueTracker Interface Implementation

JIRA-Specific Adaptations

interface JiraIssue extends Issue {
  key: string           // "PROJ-123" format
  projectKey: string    // "PROJ" 
  issueType: string     // "Story", "Bug", "Task", etc.
  priority?: string     // JIRA-specific
  components?: string[] // JIRA-specific
  fixVersions?: string[] // JIRA-specific
}

class JiraService implements IssueTracker {
  private config: {
    baseUrl: string      // https://company.atlassian.net
    projectKey: string   // Default project for new issues
    authMethod: 'api-token' | 'pat' | 'oauth'
    deployment: 'cloud' | 'server' | 'datacenter'
  }
  
  async fetchIssue(identifier: string): Promise<Issue> {
    // identifier could be "PROJ-123" or just "123" (with configured project)
    const key = this.resolveIssueKey(identifier)
    // Use jira-cli: jira issue view PROJ-123 --raw
  }
  
  // Extract numeric part for port calculation
  extractIssueNumber(key: string): number {
    // "PROJ-123" -> 123
    const match = key.match(/-(\d+)$/)
    return match ? parseInt(match[1], 10) : 0
  }
}

3. Authentication Approaches

JIRA Cloud (Recommended)

  1. API Token: Generate at https://id.atlassian.com/manage-profile/security/api-tokens

    • Usage: username:api_token as Basic auth
    • Environment variable: JIRA_API_TOKEN
  2. OAuth 2.0 (3LO): For apps requiring user consent

JIRA Server/Data Center

  1. Personal Access Token (PAT): Generate in user profile settings
    • Usage: Bearer token authentication
    • More secure than basic auth

Recommended Configuration

{
  "issueManagement": {
    "provider": "jira",
    "jira": {
      "baseUrl": "https://company.atlassian.net",
      "defaultProject": "PROJ",
      "deployment": "cloud",
      "authMethod": "api-token",
      "defaultIssueType": "Story"
    }
  }
}

4. Issue Identifier Format

JIRA Key Format

  • Format: <PROJECT_KEY>-<NUMBER> (e.g., PROJ-123, ABC-1, R2D2-42)
  • Project key: 2+ uppercase letters, can include underscores and numbers
  • Maximum project key length: 10 characters

Impact on iloom

// Port calculation: extract numeric part
function calculatePort(jiraKey: string, basePort: number = 3000): number {
  const match = jiraKey.match(/-(\d+)$/)
  if (!match) throw new Error(`Invalid JIRA key format: ${jiraKey}`)
  return basePort + parseInt(match[1], 10)
}

// Examples:
// PROJ-123  -> port 3123
// ABC-42    -> port 3042
// DEV-1000  -> port 4000

// Workspace naming: include full key for uniqueness
// "PROJ-123", "Add dark mode" -> "proj-123-add-dark-mode"

5. MCP Server Integration

Official Atlassian MCP Server (Cloud Only)

{
  "mcpServers": {
    "Atlassian": {
      "command": "npx",
      "args": ["-y", "mcp-remote@latest", "https://mcp.atlassian.com/v1/sse"]
    }
  }
}

Community MCP Server: mcp-atlassian

Available Tools:

  • Read: jira_search, jira_get_issue, jira_get_all_projects, jira_get_transitions
  • Write: jira_create_issue, jira_update_issue, jira_add_comment, jira_transition_issue
  • Agile: jira_get_agile_boards, jira_get_sprint_issues

6. JIRA-Specific Features

Complex Workflows

  • JIRA workflows are highly customizable and project-specific
  • Transitions vary by workflow (not just open/closed)
  • May require specific fields or conditions
// Get available transitions for an issue
async getAvailableTransitions(key: string): Promise<JiraTransition[]>

// Transition an issue (e.g., "To Do" -> "In Progress")  
async transitionIssue(key: string, transitionName: string): Promise<void>

Issue Types

  • Multiple types: Story, Bug, Task, Epic, Sub-task
  • Affect available workflows and fields
  • Configurable per project

Custom Fields

  • Enterprise-specific configurations
  • Identified by IDs (customfield_10001)
  • May require instance-specific mapping

7. Implementation Challenges

Challenge Impact Mitigation
Cloud vs Server API differences Different auth, field handling Detect deployment type, use appropriate adapter
Alphanumeric keys Port/naming calculation Extract numeric part, support full key input
Complex workflows Status transitions vary Fetch available transitions dynamically
Custom fields Field IDs not names Optional field mapping configuration
Project context required Can't operate without project Require defaultProject in config

8. Files to Create

  • /src/lib/JiraService.ts - JIRA implementation (~400-500 LOC)
  • /src/utils/jira.ts - JIRA CLI utilities (~200 LOC)
  • /src/types/jira.ts - JIRA type definitions (~150 LOC)
  • /src/adapters/JiraCloudAdapter.ts - Cloud-specific logic (~150 LOC)
  • /src/adapters/JiraServerAdapter.ts - Server-specific logic (~150 LOC)

Files to Modify

  • /src/lib/IssueTrackerFactory.ts - Add JiraService instantiation
  • /src/lib/SettingsManager.ts - Add JIRA-specific settings
  • /src/utils/mcp.ts - Add JIRA MCP configuration
  • /src/commands/init.ts - JIRA setup and authentication
  • /src/utils/port.ts - Support alphanumeric identifiers
  • /src/utils/branch.ts - JIRA branch naming format
  • /README.md - Document JIRA integration
  • Settings schema - JIRA configuration options

9. Implementation Steps

  1. Create JiraService Class - Implement IssueTracker interface
  2. Add Cloud/Server Adapters - Handle deployment differences
  3. Add JIRA Utilities - CLI wrapper and helper functions
  4. Update Factory - Add JIRA provider instantiation
  5. Extend Settings Schema - JIRA-specific configuration
  6. Update Init Command - JIRA setup and API key configuration
  7. Add MCP Configuration - Both official and community MCP servers
  8. Update Port/Branch Logic - Support alphanumeric identifiers
  9. Update Documentation - JIRA integration guide

10. Acceptance Criteria

  • JiraService implements all IssueTracker interface methods
  • JIRA issues can be fetched via jira-cli or ACLI
  • JIRA comments can be created via MCP server
  • Settings support JIRA project/deployment configuration
  • Init command can configure JIRA authentication
  • Alphanumeric identifiers work for port calculation
  • Branch naming supports JIRA key format (PROJ-123)
  • MCP configuration selects JIRA provider when configured
  • Support both Cloud and Server deployments
  • Issue transitions work through JIRA workflows
  • All existing GitHub/Linear functionality remains unchanged
  • TypeScript compilation succeeds
  • Tests pass for all providers (GitHub, Linear, JIRA)

11. Testing Strategy

  • Unit tests for JiraService implementation
  • Adapter tests for Cloud vs Server differences
  • Integration tests with JIRA API (mocked)
  • Factory tests for JIRA provider selection
  • Settings validation for JIRA configuration
  • Port calculation tests with alphanumeric identifiers
  • Workflow transition tests
  • End-to-end workflow tests with JIRA provider

12. Complexity Assessment

Rating: Medium-High (compared to Linear: Medium, GitHub: Low)

Estimated Effort: 8-12 days

Effort Breakdown

  • JiraService class: 2-3 days
  • Cloud/Server adapters: 1-2 days
  • Settings schema: 0.5 day
  • Input detection: 1 day
  • Port calculation: 0.5 day
  • Workflow transitions: 1 day
  • MCP server integration: 1 day
  • Testing: 2-3 days

Why More Complex Than Linear?

  1. Two deployment models (Cloud vs Server)
  2. Project-centric operations
  3. Complex, customizable workflows
  4. Enterprise-specific custom fields
  5. Alphanumeric keys requiring parsing

Dependencies


Configuration Example

{
  "issueManagement": {
    "provider": "jira",
    "jira": {
      "baseUrl": "https://company.atlassian.net",
      "defaultProject": "PROJ",
      "deployment": "cloud",
      "authMethod": "api-token",
      "defaultIssueType": "Story",
      "boardId": 123
    }
  }
}

Environment variables:

JIRA_BASE_URL=https://company.atlassian.net
JIRA_USERNAME=user@company.com
JIRA_API_TOKEN=your-api-token
# OR for Server/DC:
JIRA_PAT=your-personal-access-token

Benefits After Completion

  • Full JIRA integration for enterprise teams
  • Support for both Cloud and Server deployments
  • Project-by-project provider selection between GitHub, Linear, and JIRA
  • Enhanced AI capabilities via JIRA MCP servers
  • Maintained abstraction for future providers
  • Enterprise-grade workflow support

Parent Issue: #210
Phase: 3 of 3 (potential)
Prerequisites: #236 (required), #237 (recommended)
Estimated LOC: ~1,200-1,500
Files Impact: ~5 new, ~10 modified
Deployment Support: JIRA Cloud, Server, Data Center


Research Sources

CLI Tools

API Documentation

MCP Servers

Comprehensive research findings documented above based on Opus agent analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions