(spec: string, originalSource: string, opts: { force?: boolean })
| 77 | } |
| 78 | |
| 79 | async function installFromGithub(spec: string, originalSource: string, opts: { force?: boolean }): Promise<InstallResult> { |
| 80 | // spec is like "user/repo" or "user/repo@ref" |
| 81 | const [repoPart, ref] = spec.split('@'); |
| 82 | if (!repoPart || !/^[^/]+\/[^/]+$/.test(repoPart)) { |
| 83 | throw new Error(`Bad gh: spec "${spec}". Expected user/repo[@ref].`); |
| 84 | } |
| 85 | const tmp = await mkdtempIn(os.tmpdir(), 'qodex-skill-gh-'); |
| 86 | const url = `https://github.com/${repoPart}.git`; |
| 87 | const args = ['clone', '--depth', '1', url, tmp]; |
| 88 | if (ref) { |
| 89 | args.splice(2, 0, '--branch', ref); |
| 90 | } |
| 91 | runOrThrow('git', args, `clone ${url}`); |
| 92 | const root = await findSkillRoot(tmp); |
| 93 | return copyInto(root, originalSource, opts); |
| 94 | } |
| 95 | |
| 96 | async function installFromNpm(spec: string, originalSource: string, opts: { force?: boolean }): Promise<InstallResult> { |
| 97 | const tmp = await mkdtempIn(os.tmpdir(), 'qodex-skill-npm-'); |
no test coverage detected