| 3 | import type { CollectResult } from './utils.js'; |
| 4 | |
| 5 | export async function collectGenericGitConfig(): Promise<CollectResult> { |
| 6 | const url = await input({ |
| 7 | message: 'Git clone URL (e.g. https://github.com/sourcebot-dev/sourcebot)', |
| 8 | validate: (v) => { |
| 9 | if (!v?.trim()) { |
| 10 | return 'URL is required'; |
| 11 | } |
| 12 | if (!/^https?:\/\//.test(v)) { |
| 13 | return 'Must start with http:// or https://'; |
| 14 | } |
| 15 | return true; |
| 16 | }, |
| 17 | }); |
| 18 | |
| 19 | const config: GenericGitHostConnectionConfig = { |
| 20 | type: 'git', |
| 21 | url, |
| 22 | }; |
| 23 | |
| 24 | return { connections: [{ config }], env: {} }; |
| 25 | } |