@@ -24,8 +24,9 @@ class CustomModuleManager {
2424
2525 /**
2626 * Parse a user-provided source input into a structured descriptor.
27- * Accepts local file paths, HTTPS Git URLs, and SSH Git URLs.
28- * For HTTPS URLs with deep paths (e.g., /tree/main/subdir), extracts the subdir.
27+ * Accepts local file paths, HTTPS Git URLs, HTTP Git URLs, and SSH Git URLs.
28+ * For HTTPS/HTTP URLs with deep paths (e.g., /tree/main/subdir), extracts the subdir.
29+ * The original protocol (http or https) is preserved in the returned cloneUrl.
2930 *
3031 * @param {string } input - URL or local file path
3132 * @returns {Object } Parsed source descriptor:
@@ -127,11 +128,11 @@ class CustomModuleManager {
127128 } ;
128129 }
129130
130- // HTTPS URL: https://host/owner/repo[/tree/branch/subdir][.git]
131- const httpsMatch = trimmed . match ( / ^ h t t p s ? : \/ \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ ( [ ^ / . ] + ?) (?: \. g i t ) ? ( \/ .* ) ? $ / ) ;
131+ // HTTPS/HTTP URL: https://host/owner/repo[/tree/branch/subdir][.git]
132+ const httpsMatch = trimmed . match ( / ^ ( h t t p s ? ) : \/ \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ ( [ ^ / . ] + ?) (?: \. g i t ) ? ( \/ .* ) ? $ / ) ;
132133 if ( httpsMatch ) {
133- const [ , host , owner , repo , remainder ] = httpsMatch ;
134- const cloneUrl = `https ://${ host } /${ owner } /${ repo } ` ;
134+ const [ , protocol , host , owner , repo , remainder ] = httpsMatch ;
135+ const cloneUrl = `${ protocol } ://${ host } /${ owner } /${ repo } ` ;
135136 let subdir = null ;
136137 let urlRef = null ; // branch/tag extracted from /tree/<ref>/subdir
137138
@@ -311,7 +312,7 @@ class CustomModuleManager {
311312 /**
312313 * Clone a custom module repository to cache.
313314 * Supports any Git host (GitHub, GitLab, Bitbucket, self-hosted, etc.).
314- * @param {string } sourceInput - Git URL (HTTPS or SSH)
315+ * @param {string } sourceInput - Git URL (HTTPS, HTTP, or SSH)
315316 * @param {Object } [options] - Clone options
316317 * @param {boolean } [options.silent] - Suppress spinner output
317318 * @param {boolean } [options.skipInstall] - Skip npm install (for browsing before user confirms)
@@ -335,7 +336,7 @@ class CustomModuleManager {
335336
336337 const createSpinner = async ( ) => {
337338 if ( silent ) {
338- return { start ( ) { } , stop ( ) { } , error ( ) { } } ;
339+ return { start ( ) { } , stop ( ) { } , error ( ) { } } ;
339340 }
340341 return await prompts . spinner ( ) ;
341342 } ;
0 commit comments