/** * GitHub URL Parsing Utilities * @module @skillsmith/core/utils/github-url * * SMI-2171: Extracted from mcp-server for shared use across codebase. * Used by: * - packages/mcp-server/src/tools/install.helpers.ts (skill installation) * - scripts/batch-transform-skills.ts (batch transformation) */ /** * Parsed repository URL components */ export interface ParsedRepoUrl { /** GitHub username or organization */ owner: string; /** Repository name */ repo: string; /** Path within the repository (e.g., "skills/commit" for monorepo skills) */ path: string; /** Branch name (defaults to "main" if not specified) */ branch: string; } /** * Parse repo_url from registry to extract GitHub components. * * Handles various URL formats: * - Plain repo: `https://github.com/owner/repo` * - Tree path: `https://github.com/owner/repo/tree/branch/path` * - Blob path: `https://github.com/owner/repo/blob/branch/path` * * @example * ```typescript * // Plain repo URL * parseRepoUrl('https://github.com/user/skill') * // => { owner: 'user', repo: 'skill', path: '', branch: 'main' } * * // Monorepo skill with tree path * parseRepoUrl('https://github.com/ruvnet/claude-code/tree/main/skills/commit') * // => { owner: 'ruvnet', repo: 'claude-code', path: 'skills/commit', branch: 'main' } * ``` * * @param repoUrl - GitHub repository URL * @returns Parsed URL components * @throws Error if hostname is not GitHub * * @since SMI-1491 * @see SMI-2171 - Extracted to @skillsmith/core for shared use */ export declare function parseRepoUrl(repoUrl: string): ParsedRepoUrl; /** * Check if a URL is a valid GitHub repository URL * * @param url - URL to check * @returns true if the URL is a valid GitHub URL */ export declare function isGitHubUrl(url: string): boolean; //# sourceMappingURL=github-url.d.ts.map