Skip to content

[Feature Request] Support subdirectory fetching for GitHub repos #27

@ChrisLally

Description

@ChrisLally

When using opensrc with a GitHub repo that's a monorepo, it currently clones the entire repository. There's no way to specify a subdirectory path and fetch only that subtree.

Proposed syntax:

bashopensrc owner/repo/packages/some-package
opensrc github:owner/repo/path/to/dir
opensrc https://github.com/owner/repo/tree/main/packages/some-package

Why it matters:

Many popular packages live inside monorepos (e.g. vercel/ai, TanStack/query, facebook/react). Fetching the entire repo to get one package's source is wasteful — both in time and in tokens given to the AI agent.

Implementation note:

GitHub's Git Trees API supports fetching a specific path without cloning the full repo, so this could be done efficiently without a full checkout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions