/** * @nahisaho/musubix-codegraph - GitHub Adapter * * GitHub API integration using Octokit or gh CLI fallback * * @packageDocumentation * @module @nahisaho/musubix-codegraph/pr * * @see REQ-CG-PR-001 - GitHub Authentication * @see REQ-CG-PR-005 - GitHub PR Creation * @see DES-CG-PR-004 - Class Design */ import type { GitHubConfig, GitHubAuthMethod, GitHubAuthResult, PRInfo } from './types.js'; /** * Pull Request creation options for GitHub API */ export interface CreatePROptions { /** PR title */ title: string; /** PR body (Markdown) */ body: string; /** Head branch (the branch with changes) */ head: string; /** Base branch (the branch to merge into) */ base: string; /** Create as draft PR */ draft?: boolean; /** Maintainer can modify */ maintainerCanModify?: boolean; } /** * Options for updating a PR */ export interface UpdatePROptions { /** PR number */ number: number; /** New title */ title?: string; /** New body */ body?: string; /** New state */ state?: 'open' | 'closed'; } /** * PR label */ export interface PRLabel { name: string; color?: string; description?: string; } /** * GitHub Adapter * * Provides a unified interface for GitHub operations. * Supports both direct API access (via GITHUB_TOKEN) and gh CLI fallback. * * @see DES-CG-PR-004 * @example * ```typescript * const github = new GitHubAdapter({ owner: 'user', repo: 'project' }); * await github.authenticate(); * const pr = await github.createPullRequest({ * title: 'refactor: extract interface', * body: '...', * head: 'refactor/extract-interface', * base: 'main' * }); * ``` */ export declare class GitHubAdapter { private readonly config; private authMethod; private authenticated; private username?; /** * Create a new GitHubAdapter * @param config - GitHub configuration */ constructor(config: GitHubConfig); /** * Authenticate with GitHub * @see REQ-CG-PR-001 */ authenticate(): Promise; /** * Check if authenticated */ isAuthenticated(): boolean; /** * Get authentication method */ getAuthMethod(): GitHubAuthMethod; /** * Get authenticated username */ getUsername(): string | undefined; /** * Validate a GitHub token */ private validateToken; /** * Check if gh CLI is available */ private isGhCliAvailable; /** * Authenticate using gh CLI */ private authenticateWithGhCli; /** * Create a pull request * @see REQ-CG-PR-005 */ createPullRequest(options: CreatePROptions): Promise; /** * Create PR using GitHub API */ private createPRWithApi; /** * Create PR using gh CLI */ private createPRWithGhCli; /** * Get PR information */ getPullRequest(prNumber: number): Promise; /** * Get PR using API */ private getPRWithApi; /** * Get PR using gh CLI */ private getPRWithGhCli; /** * Add labels to PR */ addLabels(prNumber: number, labels: string[]): Promise; /** * Add reviewers to PR */ addReviewers(prNumber: number, reviewers: string[]): Promise; /** * Add assignees to PR */ addAssignees(prNumber: number, assignees: string[]): Promise; /** * Get repository information */ getRepository(): Promise<{ defaultBranch: string; private: boolean; }>; /** * Ensure authenticated before operations */ private ensureAuthenticated; } /** * Create a GitHubAdapter instance */ export declare function createGitHubAdapter(owner: string, repo: string, token?: string): GitHubAdapter; //# sourceMappingURL=github-adapter.d.ts.map