|
1 | | -import { existsSync, mkdirSync, cpSync, readFileSync, writeFileSync } from 'node:fs'; |
| 1 | +import { existsSync, mkdirSync, rmSync, cpSync, readFileSync, writeFileSync } from 'node:fs'; |
2 | 2 | import { join, resolve } from 'node:path'; |
3 | | -import { execSync } from 'node:child_process'; |
| 3 | +import { execFileSync } from 'node:child_process'; |
4 | 4 |
|
5 | 5 | export interface RegistryConfig { |
6 | 6 | name: string; |
@@ -186,22 +186,22 @@ export class GitHubProvider implements SkillRegistryProvider { |
186 | 186 | // Clone and extract specific path |
187 | 187 | const tmpDir = join(targetDir, '.tmp-git-clone'); |
188 | 188 | try { |
189 | | - execSync(`git clone --depth 1 --filter=blob:none --sparse https://github.com/${repo}.git "${tmpDir}"`, { stdio: 'pipe' }); |
190 | | - execSync(`git -C "${tmpDir}" sparse-checkout set "${subPath}"`, { stdio: 'pipe' }); |
| 189 | + execFileSync('git', ['clone', '--depth', '1', '--filter=blob:none', '--sparse', `https://github.com/${repo}.git`, tmpDir], { stdio: 'pipe' }); |
| 190 | + execFileSync('git', ['-C', tmpDir, 'sparse-checkout', 'set', subPath], { stdio: 'pipe' }); |
191 | 191 | const skillName = subPath.split('/').pop()!; |
192 | 192 | const skillDir = join(targetDir, skillName); |
193 | 193 | mkdirSync(skillDir, { recursive: true }); |
194 | 194 | cpSync(join(tmpDir, subPath), skillDir, { recursive: true }); |
195 | 195 | } finally { |
196 | 196 | if (existsSync(tmpDir)) { |
197 | | - execSync(`rm -rf "${tmpDir}"`, { stdio: 'pipe' }); |
| 197 | + rmSync(tmpDir, { recursive: true, force: true }); |
198 | 198 | } |
199 | 199 | } |
200 | 200 | } else { |
201 | 201 | // Clone entire repo as a skill |
202 | 202 | const skillName = repo.split('/').pop()!; |
203 | 203 | const skillDir = join(targetDir, skillName); |
204 | | - execSync(`git clone --depth 1 https://github.com/${repo}.git "${skillDir}"`, { stdio: 'pipe' }); |
| 204 | + execFileSync('git', ['clone', '--depth', '1', `https://github.com/${repo}.git`, skillDir], { stdio: 'pipe' }); |
205 | 205 | } |
206 | 206 | } |
207 | 207 | } |
|
0 commit comments