From d25b4b643abeb3fb72f619330762566d1b023265 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Tue, 30 Jun 2026 13:01:19 +0000 Subject: [PATCH] fix(skills): treat marketplace clone as successful when git exits non-zero but .git is valid On Windows with Git Credential Manager, git can write authentication warnings to stderr and exit non-zero even though the clone was written to disk. After a non-zero exit, verify with `git rev-parse HEAD`; only surface the error if no valid repository exists at the destination. Closes #239 Co-authored-by: Sunny Kolattukudy --- src/services/skills/commands.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/services/skills/commands.ts b/src/services/skills/commands.ts index 4968394..e368efb 100644 --- a/src/services/skills/commands.ts +++ b/src/services/skills/commands.ts @@ -263,8 +263,20 @@ export function registerSkillsCommands(program: Command): void { try { execFileSync('git', cloneArgs, { stdio: ['inherit', 'inherit', 'pipe'] }); } catch (e: unknown) { - const msg = e instanceof Error ? e.message : String(e); - throw new Error(msg.replace(/x-(?:token-auth|access-token):[^@]+@/g, 'x-token-auth:***@')); + // On some platforms (e.g. Windows with Git Credential Manager), git may + // write authentication warnings to stderr and exit non-zero even though + // the clone was successfully written to disk. Verify by running + // `git rev-parse HEAD` at the destination; if that succeeds the repo is + // valid and we continue rather than surfacing a spurious error. + let cloneActuallySucceeded = false; + try { + execFileSync('git', ['-C', resolvedPath, 'rev-parse', 'HEAD'], { stdio: 'pipe' }); + cloneActuallySucceeded = true; + } catch { /* repo not valid — fall through and re-throw original error */ } + if (!cloneActuallySucceeded) { + const msg = e instanceof Error ? e.message : String(e); + throw new Error(msg.replace(/x-(?:token-auth|access-token):[^@]+@/g, 'x-token-auth:***@')); + } } }