ds-sfcoe-ailabs
Version:
AI-powered code review tool with static analysis integration for comprehensive code quality assessment.
40 lines (39 loc) • 1.31 kB
TypeScript
import { GitProvider, GitProviderType } from './index.js';
/**
* Factory class for creating Git provider instances
*
* Provides a centralized way to create appropriate Git provider implementations
* based on the specified provider type. Currently supports GitHub providers.
*
* @example
* ```typescript
* const provider = GitProviderFactory.createProvider('github', 'owner', 'repo', 'token');
* await provider.upsertPRComment({
* pullRequestId: 123,
* message: 'Review complete'
* });
* ```
*/
export default class GitProviderFactory {
/**
* Gets a git provider instance
*
* @param type - The type of Git provider to create
* @param token - The authentication token for the provider
* @param owner - The repository owner/organization name
* @param repo - The repository name
* @returns An instance of the specified Git provider
* @throws Error when the provider type is unsupported
* @example
* ```typescript
* const provider = GitProviderFactory.getInstance(
* GitProviderType.GitHub,
* 'token123',
* 'myorg',
* 'myrepo'
* );
* await provider.upsertPRComment({...});
* ```
*/
static getInstance(type: GitProviderType, token: string, owner: string, repo: string): GitProvider;
}