/** * GitHub App Manifest Flow for Automated Setup * * Provides functions for creating GitHub Apps via the App Manifest flow, * which simplifies setup from 15+ manual steps to a single CLI command. */ /** * Configuration for generating an app manifest */ export interface ManifestConfig { organization: string; repository: string; appName?: string; } /** * GitHub App Manifest structure * @see https://docs.github.com/en/apps/sharing-github-apps/registering-a-github-app-from-a-manifest */ export interface GitHubAppManifest { name: string; url: string; hook_attributes: { url: string; }; redirect_url?: string; callback_urls?: string[]; setup_url?: string; description: string; public: boolean; default_permissions: { contents: 'read' | 'write'; issues: 'read' | 'write'; pull_requests: 'read' | 'write'; metadata: 'read'; }; default_events: string[]; } /** * Response from GitHub App Manifest conversion API * @see https://docs.github.com/en/rest/apps/apps#create-a-github-app-from-a-manifest */ export interface ManifestConversionResponse { id: number; slug: string; node_id: string; owner: { login: string; id: number; }; name: string; description: string; external_url: string; html_url: string; created_at: string; updated_at: string; permissions: { contents?: string; issues?: string; metadata?: string; pull_requests?: string; }; events: string[]; installations_count: number; client_id: string; client_secret: string; webhook_secret: string | null; pem: string; } /** * App credentials extracted from manifest conversion */ export interface AppCredentials { id: string; installation_id: string; private_key: string; app_slug: string; app_name: string; } /** * Generate GitHub App manifest with FABER's required permissions */ export declare function generateAppManifest(config: ManifestConfig): GitHubAppManifest; /** * Generate HTML content for manifest submission * * The GitHub App Manifest flow requires POSTing a form to GitHub. * Since CLI cannot POST directly, we generate an HTML file that the user * opens in their browser and clicks to submit. * * @param manifest - The app manifest to submit * @param organization - GitHub organization name * @returns HTML content ready to save to file */ export declare function generateManifestHtml(manifest: GitHubAppManifest, organization: string): string; /** * Exchange manifest code for app credentials * * @param code - The code from the GitHub redirect URL * @returns App credentials from GitHub * @throws Error if code is invalid or API request fails */ export declare function exchangeCodeForCredentials(code: string): Promise; /** * Validate app credentials from manifest conversion * * @param response - The manifest conversion response * @throws Error if response is invalid */ export declare function validateAppCredentials(response: ManifestConversionResponse): void; /** * Fetch installation ID for the app in the specified organization * * @param appId - The GitHub App ID * @param privateKey - The app's private key in PEM format * @param organization - The GitHub organization name * @returns The installation ID * @throws Error if installation not found or authentication fails */ export declare function getInstallationId(appId: string, privateKey: string, organization: string): Promise; /** * Save private key to secure location * * @param privateKey - The private key content * @param organization - The organization name (for filename) * @returns Path to the saved private key file * @throws Error if file cannot be saved */ export declare function savePrivateKey(privateKey: string, organization: string): Promise; /** * Format permissions for display * * @param manifest - The app manifest * @returns Formatted permissions string */ export declare function formatPermissionsDisplay(manifest: GitHubAppManifest): string; //# sourceMappingURL=github-app-setup.d.ts.map