/** * GitHub Integration for Issue Tracker Setup * * Handles GitHub.com and GitHub Enterprise authentication * Supports manual token entry and gh CLI auto-detection * * @module cli/helpers/issue-tracker/github */ import type { GitHubCredentials, ExistingCredentials, ValidationResult } from './types.js'; import type { SupportedLanguage } from '../../../core/i18n/types.js'; /** * Check for existing GitHub credentials * * Priority: .env > GH_TOKEN > GITHUB_TOKEN > gh CLI config * * @param projectPath - Path to project root * @returns Existing credentials or null */ export declare function checkExistingGitHubCredentials(projectPath: string): Promise; /** * Prompt user for GitHub credentials * * Supports: * - Manual token entry * - gh CLI auto-detection * - GitHub.com vs GitHub Enterprise selection * * @param language - User's language * @returns Credentials or null if skipped */ export declare function promptGitHubCredentials(language: SupportedLanguage): Promise; /** * Validate GitHub connection * * Tests authentication and returns user information * Handles rate limiting with retry logic * * @param credentials - GitHub credentials * @param maxRetries - Maximum retry attempts (default: 3) * @returns Validation result */ export declare function validateGitHubConnection(credentials: GitHubCredentials, maxRetries?: number): Promise; /** * Get GitHub environment variables for .env file * * @param credentials - GitHub credentials * @returns Array of key-value pairs for .env */ export declare function getGitHubEnvVars(credentials: GitHubCredentials): Array<{ key: string; value: string; }>; /** * Show GitHub setup complete message * * @param language - User's language */ export declare function showGitHubSetupComplete(language: SupportedLanguage): void; /** * Show GitHub setup skipped message * * @param language - User's language */ export declare function showGitHubSetupSkipped(language: SupportedLanguage): void; /** * Configure GitHub repositories * * CRITICAL OPTIMIZATION (v0.36.0+): When GitHub is used for BOTH repositories AND issue tracking, * this function detects existing repository configuration and reuses it instead of asking again. * * This is called after credentials are validated to set up repository profiles. * v1.0.13: Simplified - removed parent repo concept. Each repo = 1 project (1:1 mapping). * * @param projectPath - Path to project directory * @param language - User's language * @param githubToken - Optional GitHub token for repository creation * @param repositoryHosting - Optional repository hosting choice from init.ts (prevents duplicate prompts) * @param githubCredentialsFromRepoSetup - Optional GitHub credentials from repository setup * @param gitUrlFormat - Optional Git URL format from repository setup (SSH or HTTPS) - v1.0.8+ * @returns Repository profiles */ export declare function configureGitHubRepositories(projectPath: string, language: SupportedLanguage, githubToken?: string, repositoryHosting?: string, githubCredentialsFromRepoSetup?: { org: string; pat: string; clonedRepos?: string[]; }, gitUrlFormat?: 'ssh' | 'https'): Promise<{ profiles: any[]; monorepoProjects?: string[]; }>; /** * Validate GitHub write access to a specific repository * * CRITICAL (v0.33.0): This function tests that the token has WRITE permissions * to the configured repository. This catches permission issues DURING init * instead of later when user tries to sync. * * Test methodology: * 1. Try to get repo (confirms read access and repo exists) * 2. Try to create a test label (confirms write access) * 3. Clean up test label immediately * * @param credentials - GitHub credentials * @param owner - Repository owner * @param repo - Repository name * @returns Validation result with specific error messages */ export declare function validateGitHubWriteAccess(credentials: GitHubCredentials, owner: string, repo: string): Promise<{ success: boolean; error?: string; errorType?: 'repo_not_found' | 'no_read_access' | 'no_write_access' | 'token_scope' | 'rate_limit' | 'unknown'; suggestion?: string; }>; /** * Force prompt for a new GitHub token with proper scopes * * Called when existing token (e.g., from gh CLI) lacks write permissions. * User MUST provide a new token - cannot skip this step. * * @param language - User's language * @param currentSource - Source of the failing token (for user context) * @param errorMessage - Error message explaining why new token is needed * @returns New credentials or null if user refuses (setup will fail) */ export declare function forcePromptGitHubToken(language: SupportedLanguage, currentSource: string, errorMessage: string): Promise; //# sourceMappingURL=github.d.ts.map