From 2af55f482c268fab1a41ffde88e224a3e7dabb8d Mon Sep 17 00:00:00 2001 From: elliotllliu <55885132+elliotllliu@users.noreply.github.com> Date: Sun, 15 Mar 2026 20:18:06 +0000 Subject: [PATCH] fix: initialize git submodules when cloning repositories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After cloning a repository, run `git submodule update --init --recursive --depth 1` to initialize any submodules. This allows skills in submodule directories to be discovered by `skills add`. The submodule init is best-effort with shallow depth to minimize overhead — if no submodules exist or init fails, cloning proceeds normally. Closes #492 --- src/git.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/git.ts b/src/git.ts index fff86f58..389e9c1f 100644 --- a/src/git.ts +++ b/src/git.ts @@ -29,6 +29,19 @@ export async function cloneRepo(url: string, ref?: string): Promise { try { await git.clone(url, tempDir, cloneOptions); + + // Initialize submodules if any exist + try { + const repoGit = simpleGit({ + timeout: { block: CLONE_TIMEOUT_MS }, + env: { ...process.env, GIT_TERMINAL_PROMPT: '0' }, + }); + await repoGit.cwd(tempDir); + await repoGit.submoduleUpdate(['--init', '--recursive', '--depth', '1']); + } catch { + // Submodule init is best-effort — skip silently if no submodules or if it fails + } + return tempDir; } catch (error) { // Clean up temp dir on failure