/** * Jira API Client * * Supports: * 1. MCP Server (Atlassian Remote MCP) - Primary * 2. REST API v3 - Fallback * * Features: * - List issues with JQL filtering (by sprint, status, etc.) * - Create issues (Epic, Story, Subtask, Bug, Task) * - Update issues * - Get sprint information */ import { Logger } from '../../utils/logger.js'; /** * Set the logger for this module */ export declare function setJiraClientLogger(logger: Logger): void; export interface JiraIssue { id: string; key: string; fields: { summary: string; description?: any; issuetype: { id: string; name: string; }; status: { id: string; name: string; }; priority?: { id: string; name: string; }; labels?: string[]; assignee?: { accountId: string; displayName: string; emailAddress: string; }; parent?: { id: string; key: string; fields: { summary: string; }; }; customfield_10014?: any; [key: string]: any; }; self: string; } export interface JiraSprint { id: number; name: string; state: 'future' | 'active' | 'closed'; startDate?: string; endDate?: string; completeDate?: string; originBoardId: number; } export interface JiraIssueFilter { issueType?: string[]; status?: string[]; sprint?: string | number; labels?: string[]; assignee?: string; project?: string; jql?: string; maxResults?: number; updatedSince?: Date; issueKeys?: string[]; } /** * External change representation for pull sync */ export interface JiraExternalChange { platform: 'jira'; externalId: string; issueKey: string; changedAt: string; changedBy: string; changedFields: Array<{ field: string; oldValue: unknown; newValue: unknown; }>; currentState: { status: string; priority: string | null; assignee: string | null; }; } export interface JiraIssueCreate { issueType: 'Epic' | 'Story' | 'Sub-task' | 'Bug' | 'Task'; summary: string; description?: string; priority?: string; labels?: string[]; parentKey?: string; epicKey?: string; customFields?: Record; } export interface JiraIssueUpdate { key: string; summary?: string; description?: string; status?: string; priority?: string; labels?: string[]; customFields?: Record; } export declare class JiraClient { private credentials; private baseUrl; private apiVersion; constructor(); /** * Get authorization header for REST API */ private getAuthHeader; /** * Extract plain text from Atlassian Document Format (ADF) */ private extractTextFromAdf; /** * Search issues using JQL */ searchIssues(filter?: JiraIssueFilter): Promise; /** * Build JQL query from filter */ private buildJqlQuery; /** * Create a new issue */ createIssue(issue: JiraIssueCreate, projectKey: string): Promise; /** * Update an existing issue */ updateIssue(update: JiraIssueUpdate): Promise; /** * Transition issue to a new status */ private transitionIssue; /** * Get issue by key */ getIssue(issueKey: string): Promise; /** * Get sprints for a board */ getSprints(boardId: number): Promise; /** * Get active sprints */ getActiveSprints(boardId: number): Promise; /** * Test connection to Jira */ testConnection(): Promise; /** * Get projects accessible to the user */ getProjects(): Promise; /** * Search projects with pagination (for three-tier loading) * * @param options Search options * @returns Paginated project results */ searchProjects(options?: { maxResults?: number; startAt?: number; orderBy?: string; }): Promise; /** * Get boards for a project * * @param projectKey Project key (e.g., "BACKEND") * @returns Boards array */ getBoards(projectKey: string): Promise; /** * Get components for a project * * @param projectKey Project key (e.g., "BACKEND") * @returns Components array */ getComponents(projectKey: string): Promise; /** * Get versions for a project * * @param projectKey Project key (e.g., "BACKEND") * @returns Versions array */ getVersions(projectKey: string): Promise; /** * Fetch recently changed issues for pull sync (Increment 0089) * * Queries JIRA for issues that have changed since a given timestamp. * Uses JQL `updated >=` filter and optionally requests changelog expansion. * * @param since - Timestamp to query changes from * @param linkedIssueKeys - Optional list of issue keys to filter (linked items only) * @returns Array of external changes with changedAt, changedBy, and current values */ fetchRecentChanges(since: Date, linkedIssueKeys?: string[]): Promise; /** * Get issue changelog for detailed change tracking * * Use this for detailed changelog when needed. * GET /rest/api/3/issue/{issueKey}/changelog * * @param issueKey - Issue key * @param maxResults - Limit number of changelog entries * @returns Array of changelog entries with field changes */ getIssueChangelog(issueKey: string, maxResults?: number): Promise; /** * Get last comment on JIRA issue (for idempotency check) * * GET /rest/api/3/issue/{issueIdOrKey}/comment?orderBy=-created&maxResults=1 * * Returns the most recent comment body, or null if no comments exist. * Used to prevent posting duplicate progress comments. */ getLastComment(issueKey: string): Promise<{ body: string; author: string; } | null>; /** * Add comment to JIRA issue (T-034C) * * POST /rest/api/3/issue/{issueIdOrKey}/comment */ addComment(issueKey: string, comment: string): Promise; /** * Add remote link to JIRA issue (for PR linking) * * POST /rest/api/3/issue/{issueIdOrKey}/remotelink * Uses globalId for idempotency — re-running won't create duplicates. */ addRemoteLink(issueKey: string, link: { url: string; title: string; globalId: string; relationship?: string; }): Promise; /** * Execute raw JQL search query * * Used by FilterProcessor for custom JQL filtering * * @param jql - JQL query string * @param maxResults - Maximum results (default: 100) * @returns Search response with issues */ searchWithJql(jql: string, maxResults?: number): Promise<{ issues: JiraIssue[]; total: number; }>; } //# sourceMappingURL=jira-client.d.ts.map