/** * GitHub configuration parsing and URL detection. * Handles detection of GitHub URLs, parsing repo specs, and allowlist validation. */ /** * Parsed GitHub repository specification. */ export interface GitHubRepoSpec { owner: string; repo: string; ref?: string; subpath?: string; } /** * GitHub-specific configuration from environment variables. */ export interface GitHubConfig { token?: string; pollIntervalMs: number; cacheDir: string; allowedOrgs: string[]; allowedUsers: string[]; } /** * Check if a path is a GitHub URL. * Detects paths containing "github.com". */ export declare function isGitHubUrl(urlOrPath: string): boolean; /** * Parse a GitHub URL into a GitHubRepoSpec. * * Supported formats: * github.com/owner/repo * github.com/owner/repo@ref * github.com/owner/repo/subpath * github.com/owner/repo/subpath@ref * https://github.com/owner/repo * https://github.com/owner/repo.git * * @param url - The GitHub URL to parse * @returns Parsed GitHubRepoSpec * @throws Error if URL format is invalid */ export declare function parseGitHubUrl(url: string): GitHubRepoSpec; /** * Check if a repository is allowed by the allowlist. * If no allowlist is configured (both allowedOrgs and allowedUsers empty), * all repos are DENIED by default for security. * * @param spec - The repository specification * @param config - GitHub configuration with allowlists * @returns true if allowed, false if blocked */ export declare function isRepoAllowed(spec: GitHubRepoSpec, config: GitHubConfig): boolean; /** * Get GitHub configuration from environment variables and config file. * Environment variables take precedence over config file. * * Environment variables: * GITHUB_TOKEN - Authentication token for private repos * GITHUB_POLL_INTERVAL_MS - Polling interval (0 to disable, default 300000) * SKILLJACK_CACHE_DIR - Cache directory (default ~/.skilljack/github-cache) * GITHUB_ALLOWED_ORGS - Comma-separated list of allowed organizations (overrides config) * GITHUB_ALLOWED_USERS - Comma-separated list of allowed users (overrides config) */ export declare function getGitHubConfig(): GitHubConfig; /** * Get the local cache path for a GitHub repository. * * @param spec - The repository specification * @param cacheDir - Base cache directory * @returns Full path to the cached repository (including subpath if specified) */ export declare function getRepoCachePath(spec: GitHubRepoSpec, cacheDir: string): string; /** * Get the local clone path for a GitHub repository (without subpath). * This is where the git repository is cloned to. * * @param spec - The repository specification * @param cacheDir - Base cache directory * @returns Full path to the cloned repository root */ export declare function getRepoClonePath(spec: GitHubRepoSpec, cacheDir: string): string;