Automatically analyze and fix JIRA maintenance tickets using Cursor AI.
The repos-fix plugin integrates JIRA issue tracking with the Cursor AI agent to automatically implement fixes for maintenance tickets. It operates as a plugin for the repos tool.
Key features:
- Fetches JIRA ticket details: including description, priority, and attachments.
- Analyzes the codebase: Detects platform (Java, iOS, Android, Angular), frameworks, and test structure.
- Generates comprehensive prompts: Creates a "mission" for Cursor AI tailored to the specific project context.
- Runs cursor-agent: Executes the fix in headless mode with auto-retries.
- Validates the implementation: verifying build and tests pass.
repostool installed (this plugin is included with it).cursor-agentCLI installed and available in PATH.- JIRA Account: with API token access.
- Cursor API Key: for the AI agent.
-
repos tool: Ensure you have the
repostool installed.repos-fixis a built-in plugin. -
cursor-agent: Install the Cursor Agent CLI:
curl https://cursor.com/install -fsS | bashVerify installation with
cursor-agent --version.
Set the following environment variables:
# JIRA Configuration
export JIRA_URL=https://your-company.atlassian.net
export JIRA_USERNAME=your-email@company.com
export JIRA_API_TOKEN=your-jira-api-token
# Cursor API Key
export CURSOR_API_KEY=your-cursor-api-key- JIRA API Token: Generate at id.atlassian.com.
- Cursor API Key: Get it from Cursor Settings → General → API Keys.
You can customize the AI prompts and guidelines by placing files in your configuration directory:
${XDG_CONFIG_HOME}/repos/fix/(usually~/.config/repos/fix/)
Supported files:
cursor_prompt.md: The main instruction set for Cursor.cursorrules.md: Behavior rules for the agent.agent_prompt.md: The mission prompt passed tocursor-agent.- Platform guidelines:
guidelines_ios.md,guidelines_android.md,guidelines_java.md,guidelines_angular.md.
Fix a JIRA ticket in a specific repository:
# Single repository (by name)
repos fix my-backend-service --ticket MAINT-1234
# Multiple repositories
repos fix backend-service frontend-app --ticket MAINT-1234If you are already in a repos context (e.g., using tag filters), you can omit the repository name:
# Fix a ticket in all repos matching 'production' tag
repos fix -t production --ticket MAINT-1234
# Auto-select if only one repo is in the current context
repos fix --ticket MAINT-1234You can provide the full URL instead of just the ID:
repos fix mobile-app --ticket https://company.atlassian.net/browse/MAINT-1234Analyze the issue and propose a solution without making code changes:
repos fix my-service --ticket MAINT-1234 --askThis generates a SOLUTION_SUMMARY.md with the proposed plan.
--workspace <DIR>: Specify a custom directory for generated artifacts (default:workspace/fix/<TICKET_ID>).--prompt "...": Append extra instructions to the AI agent (e.g., "Use Java 17 features").--knowledge-dir <DIR>: Copy markdown knowledge base files into the workspace and inline selected content into prompts.
When you run repos fix, the following steps occur:
- Fetch Ticket: Downloads JIRA ticket information, description, and attachments.
- Setup Workspace: Creates a working directory at
workspace/fix/<TICKET_ID>/. - Analyze Project: detailed inspection of platform, languages, frameworks, dependencies, and test setup.
- Generate Context: Creates
mission-context.jsonwith all analysis data. - Generate Prompts: Creates
.cursorrulesandcursor_prompt.mdtailored to the specific project. - Include Knowledge Base (optional): Copies markdown docs into
workspace/fix/<TICKET_ID>/knowledge/and inlines selected docs into the prompt. - Run Cursor Agent:
- Executes
cursor-agentwith--forceand--printflags. - Auto-Retry: If the agent fails (e.g., build fails, tests fail), it automatically retries up to 3 times, feeding the error message back to the AI.
- Workflow Switch: CVE/security tickets use a safe upgrade protocol (no vulnerability reproduction); bug fixes require a repro-first flow.
- Executes
- Validate: The agent validates the fix by running build and test commands detected during analysis.
- Report: Generates
SOLUTION_SUMMARY.mdwith implementation details.
After execution, check the workspace/fix/<TICKET_ID>/ directory:
workspace/fix/MAINT-1234/
├── .cursorrules # AI behavior rules
├── mission-context.json # Complete project analysis & ticket data
├── cursor_prompt.md # The "rulebook" for Cursor
├── agent_prompt.md # The specific mission prompt
├── ANALYSIS.md # Required pre-change analysis (root cause & plan)
├── SOLUTION_SUMMARY.md # Final report of the implemented solution
Note: ANALYSIS.md is expected to be filled in by the agent before any changes.
The plugin automatically detects and supports:
- iOS: Xcode projects (
.xcodeproj,.xcworkspace), Swift/Obj-C, CocoaPods, SPM. - Android: Gradle projects, Kotlin/Java, Android Manifests.
- Java Backend: Maven (
pom.xml) or Gradle (build.gradle), Spring Boot, JUnit/Mockito. - Angular:
angular.jsonorpackage.jsonwith Angular dependencies, TypeScript.
Install it via curl https://cursor.com/install -fsS | bash. Ensure it is in your $PATH.
Check your environment variables:
echo $JIRA_URL
echo $JIRA_USERNAME
echo $JIRA_API_TOKENEnsure JIRA_API_TOKEN is a valid API token, not your password.
If using context filtering (e.g., -t tag), ensure the repository actually matches the filter. You can list matches with repos list -t tag.
Check the console output for the error message returned by cursor-agent. If it fails 3 times, check the generated prompts in the workspace directory to see if the AI instructions need manual adjustment (using --prompt).