feat: add subpath support for monorepo sparse checkout#28
Open
ChrisLally wants to merge 2 commits intovercel-labs:mainfrom
Open
feat: add subpath support for monorepo sparse checkout#28ChrisLally wants to merge 2 commits intovercel-labs:mainfrom
ChrisLally wants to merge 2 commits intovercel-labs:mainfrom
Conversation
- Parse owner/repo/subpath syntax in parseRepoSpec - Add sparse checkout when subpath specified (--filter=blob:none --sparse) - Support github:, URLs, and tree/ref/subpath formats - Add tests for subpath parsing and detectInputType
|
@ChrisLally is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #27
Summary
Adds support for fetching only a subdirectory from a GitHub (or other git host) monorepo instead of the full repo. Uses
git sparse-checkoutwith--filter=blob:noneso only the requested path is downloaded.^ For example, I only wanted part of the vercel repo so the command "opensrc vercel/vercel/packages/cli" worked great now!
Supported syntax
Implementation
lib/repo.ts): ExtendedparseRepoSpecto handle 3+ path segments and extract asubpath(e.g.vercel/ai/packages/ai→owner: vercel,repo: ai,subpath: packages/ai).types.ts): Added optionalsubpathtoRepoSpecandResolvedRepo.lib/git.ts): Whensubpathis set, usesgit clone --filter=blob:none --sparseandgit sparse-checkout set <subpath>instead of a full clone.opensrc/repos/github.com/owner/repo/packages/aito mirror the repo layout.Why sparse checkout
Testing
parseRepoSpec(owner/repo/subpath, URLs with tree/ref/subpath,github:prefix).isRepoSpecanddetectInputTypewith subpath formats.opensrc vercel/ai/packages/ai.Breaking changes
None. Existing
owner/repousage is unchanged; subpath support is additive.