/** * GitHub Connector Implementation * * Extracts achievements from GitHub repositories via the gh CLI. * Supports commits, pull requests, issues, and PR comments. * Alternative to GitConnector for GitHub-hosted repositories. * * Key Benefits: * - No local clone required * - Rich PR data with descriptions and review context * - Multiple data types from single source (commits, PRs, issues) * - Per-file statistics included * * Prerequisites: * - gh CLI installed (https://cli.github.com/) * - gh CLI authenticated (run `gh auth login`) */ import type { Connector, ConnectorConfig, ConnectorData } from './types'; /** * GitHub Connector - Implements Connector interface for GitHub repositories. * * Transforms GitHub commits, PRs, and issues into the standardized ConnectorData * format for integration with the achievement extraction pipeline. * * @example * const github = new GitHubConnector(); * await github.initialize({ * type: 'github', * sourceId: '550e8400-e29b-41d4-a716-446655440000', * projectId: 'f47ac10b-58cc-4372-a567-0e02b2c3d479', * repo: 'owner/repo', * includeCommits: true, * includePRs: true, * includeIssues: false, * }); * * const data = await github.fetch({ since: new Date('2025-11-01') }); * console.log(`Fetched ${data.length} items`); */ export declare class GitHubConnector implements Connector { private config; private cache; private sourceId; /** * Get the connector type identifier. * @returns 'github' - Always returns the github connector type */ get type(): 'github'; /** * Initialize the connector with GitHub configuration. * * Validates that the configuration is for GitHub type, stores the configuration, * initializes the commit cache, and prepares for data fetching. * * @param config - Connector configuration with github-specific fields * @throws Error if config.type is not 'github' or initialization fails * * @example * await connector.initialize({ * type: 'github', * sourceId: 'uuid-here', * projectId: 'uuid-here', * repo: 'owner/repo', * includeCommits: true, * includePRs: true, * }); */ initialize(config: ConnectorConfig): Promise; /** * Validate that the GitHub repository is accessible and properly configured. * * Checks that gh CLI is installed, authenticated, and can access the repo. * Used during setup to verify source configuration before extraction. * * @returns true if repository is valid and accessible, false otherwise * * @example * if (await connector.validate()) { * console.log('Repository is ready for extraction'); * } else { * console.warn('Repository configuration invalid'); * } */ validate(): Promise; /** * Fetch commits from GitHub API * * @param options - Fetch options * @param options.since - Fetch commits after this date * @param options.limit - Maximum number of commits to fetch * @returns Array of ConnectorData items representing commits */ private fetchCommits; /** * Fetch merged pull requests from GitHub * * @param options - Fetch options * @param options.since - Fetch PRs merged after this date * @param options.limit - Maximum number of PRs to fetch * @returns Array of ConnectorData items representing PRs */ private fetchPullRequests; /** * Fetch closed issues from GitHub * * Retrieves issues that the authenticated user authored and that have been * closed. Useful for tracking feature requests, bug fixes, and other work * items that resulted in achievements. * * @param options - Fetch options * @param options.since - Fetch issues closed after this date * @param options.limit - Maximum number of issues to fetch * @returns Array of ConnectorData items representing issues * * @example * const issues = await connector.fetchIssues({ * since: new Date('2025-11-01'), * limit: 50, * }); */ private fetchIssues; /** * Fetch data from GitHub repository. * * Orchestrates fetching of commits, PRs, and issues based on configuration. * Uses cache to avoid re-processing previously seen items. * * @param options - Fetch options for filtering and control * @param options.since - Fetch data after this date (for incremental extraction) * @param options.until - Fetch data before this date (for testing/debugging) * @param options.limit - Maximum number of items to fetch per type * @param options.skipCache - If true, bypass cache and fetch all data * @returns Array of ConnectorData items in standardized format * @throws Error if repository is not accessible or fetch fails * * @example * const data = await connector.fetch({ * since: new Date('2025-11-01'), * limit: 100, * skipCache: false, * }); */ fetch(options?: { since?: Date; until?: Date; limit?: number; skipCache?: boolean; }): Promise; /** * Clear the cache for this source. * * Removes all cached items for this specific source ID, forcing * a complete re-fetch on the next extraction. Useful for manual * refresh or troubleshooting. * * @throws Error if cache clearing fails * * @example * await connector.clearCache(); * const data = await connector.fetch({ skipCache: true }); */ clearCache(): Promise; } //# sourceMappingURL=github-connector.d.ts.map