/** * Import Coordinator * * Orchestrates multi-platform imports from GitHub, JIRA, and Azure DevOps. * Handles parallel execution, progress tracking, and result aggregation. */ import type { ExternalItem, ImportConfig, ImportResult } from './external-importer.js'; import { type RateLimitInfo } from './rate-limiter.js'; import type { WorkspaceConfig } from '../core/config/types.js'; /** * Repository configuration for multi-repo imports */ export interface RepoConfig { owner: string; repo: string; } /** * Enhanced progress info for tracking large imports */ export interface ProgressInfo { platform: string; current: number; total?: number; percentage?: number; rate?: number; eta?: number; sourceRepo?: string; page?: number; } export interface CoordinatorConfig { /** Import from GitHub (single repo - backwards compatible) */ github?: { owner: string; repo: string; token?: string; }; /** Import from multiple GitHub repositories (multi-repo support) */ githubRepositories?: RepoConfig[]; /** GitHub token (used when githubRepositories is set) */ githubToken?: string; /** Import from JIRA */ jira?: { host: string; email?: string; apiToken?: string; /** Organization mode (auto-detected or user-chosen) */ mode?: 'simple' | 'by-project' | 'by-board' | 'hybrid'; /** Project → Board mappings for 2-level folder structure */ projectMappings?: Array<{ projectKey: string; boardMappings: Array<{ boardId?: number; boardName: string; specweaveFolder: string; }>; }>; }; /** Import from Azure DevOps */ ado?: { orgUrl: string; project: string; pat?: string; /** Organization mode (auto-detected or user-chosen) */ mode?: 'simple' | 'by-project' | 'by-area'; /** Project → Area Path mappings for 2-level folder structure */ projectMappings?: Array<{ projectName: string; areaMappings: Array<{ areaPath: string; specweaveFolder: string; }>; }>; }; /** Common import configuration */ importConfig?: ImportConfig; /** Run imports in parallel (default: true) */ parallel?: boolean; /** Progress callback (legacy - count only) */ onProgress?: (platform: string, count: number, total?: number) => void; /** Enhanced progress callback with percentage and ETA */ onProgressEnhanced?: (info: ProgressInfo) => void; /** Project root for sync metadata (default: process.cwd()) */ projectRoot?: string; /** Enable sync metadata tracking (default: true) */ enableSyncMetadata?: boolean; /** Enable rate limiting (default: true) */ enableRateLimiting?: boolean; /** Callback when rate limit warning */ onRateLimitWarning?: (platform: string, rateLimitInfo: RateLimitInfo) => void; /** Callback when rate limit pause */ onRateLimitPause?: (platform: string, seconds: number) => void; } export interface CoordinatorResult { /** Combined results from all platforms */ results: ImportResult[]; /** Total items imported across all platforms */ totalCount: number; /** All imported items */ allItems: ExternalItem[]; /** Errors by platform */ errors: Record; /** Platforms that were imported from */ platforms: Array<'github' | 'jira' | 'ado'>; /** Total items skipped as duplicates (if duplicate detection enabled) */ totalSkipped?: number; } /** * Import Coordinator */ export declare class ImportCoordinator { private importers; /** Multi-repo importers keyed by "github:owner/repo" */ private githubRepoImporters; /** Multi-project ADO importers keyed by "ado:projectName" */ private adoProjectImporters; /** Multi-project JIRA importers keyed by "jira:projectKey" */ private jiraProjectImporters; private config; private rateLimiter; private projectRoot; private importStartTime; constructor(config: CoordinatorConfig); /** * Initialize importers based on configuration */ private initializeImporters; /** * Import from all configured platforms */ importAll(): Promise; /** * Import from platforms in parallel */ private importParallel; /** * Import from platforms sequentially */ private importSequential; /** * Import from a single GitHub repo with source tagging */ private importFromGitHubRepo; /** * Import from a single ADO project with source tagging (multi-project support) */ private importFromAdoProject; /** * Import from a single JIRA project with source tagging * MIRRORS importFromAdoProject for JIRA multi-project support. * * @param importer - JiraImporter instance configured for this project * @param projectKey - JIRA project key (e.g., "PROJ") */ private importFromJiraProject; /** * Import from a single platform with progress tracking */ private importFromPlatform; /** * Aggregate results from all platforms */ private aggregateResults; /** * Import from a specific platform only */ importFrom(platform: 'github' | 'jira' | 'ado'): Promise; /** * Get list of configured platforms */ getConfiguredPlatforms(): Array<'github' | 'jira' | 'ado'>; /** * Check if a platform is configured */ isPlatformConfigured(platform: 'github' | 'jira' | 'ado'): boolean; /** * Get list of configured GitHub repositories (for multi-repo support) */ getConfiguredGitHubRepos(): string[]; /** * Get list of configured ADO projects (for multi-project support) */ getConfiguredAdoProjects(): string[]; /** * Get list of configured JIRA projects (for multi-project support) */ getConfiguredJiraProjects(): string[]; private extractKeysWithPrefix; } /** * Resolve which workspace repo an external import source maps to. * * Matches by: * - GitHub: owner/repo against workspace.repos[].sync.github * - JIRA: project key against workspace.repos[].sync.jira.projectKey * - ADO: project name against workspace.repos[].sync.ado.project * * Returns workspace.name when no match found (with a warning logged). * * @param workspace - WorkspaceConfig from config.json * @param platform - Import source platform * @param sourceId - Source identifier (e.g., "acme/fe" for GitHub, "BE" for JIRA) * @returns The matching workspace repo id, or workspace.name as fallback */ export declare function resolveProjectFromWorkspace(workspace: WorkspaceConfig | undefined, platform: 'github' | 'jira' | 'ado', sourceId: string): string; //# sourceMappingURL=import-coordinator.d.ts.map